From ecdbf5ee0ce73f007ed739c22beb52c4bd10029e Mon Sep 17 00:00:00 2001 From: jjongs2 Date: Mon, 21 Aug 2023 14:58:49 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[style]=20=EB=B2=84=ED=8A=BC=20=EC=A0=84?= =?UTF-8?q?=EC=97=AD=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/globals.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/styles/globals.css b/styles/globals.css index ab8d701..89ef3fb 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -10,6 +10,10 @@ div#__next > div { height: 100%; } +.button { + @apply rounded-[20px] bg-[#6A70FF] font-bold text-white hover:bg-[#6AA6FF]; +} + .category { @apply relative flex flex-col items-center justify-between rounded-3xl shadow-xl hover:scale-105; } From 611b558b7c9fb9fc52e7e2ae561acd8bc5ee1136 Mon Sep 17 00:00:00 2001 From: jjongs2 Date: Mon, 21 Aug 2023 15:02:08 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[feat]=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=EC=97=90=20url=20=EB=A7=81=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pages/login.tsx b/pages/login.tsx index 7b64ae2..79950aa 100644 --- a/pages/login.tsx +++ b/pages/login.tsx @@ -1,14 +1,8 @@ -import Btn from '@/components/common/Btn'; import Image from 'next/image'; import Link from 'next/link'; -import { useRouter } from 'next/router'; import type { ReactElement } from 'react'; export default function Login(): ReactElement { - const router = useRouter(); - const onSignIn = (): void => { - router.push('/'); - }; return (
@@ -31,7 +25,12 @@ export default function Login(): ReactElement { className='lg:animate-bounce' />
- + +

Sign in

+
42 Check - in
From 00d16f84b9e66079a7b6441d894f5ae65ac965e4 Mon Sep 17 00:00:00 2001 From: jjongs2 Date: Mon, 21 Aug 2023 15:14:46 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[feat]=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EB=A1=9C=EB=94=A9=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Loading.tsx | 8 ++++---- pages/_app.tsx | 27 ++------------------------- pages/oauth/login/index.tsx | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 pages/oauth/login/index.tsx diff --git a/components/Loading.tsx b/components/Loading.tsx index 5082ec2..2325a73 100644 --- a/components/Loading.tsx +++ b/components/Loading.tsx @@ -1,11 +1,11 @@ -import { type ReactElement } from 'react'; +import type { ReactElement } from 'react'; export default function Loading(): ReactElement { return ( -
-
👀
+
+
👀
로딩중...💻
-
현재 API를 요청하고 있는 것 같네요...
+
현재 API를 요청하고 있는 것 같네요...
); } diff --git a/pages/_app.tsx b/pages/_app.tsx index 2277c8a..00e5f1d 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -2,12 +2,11 @@ import Loading from '@/components/Loading'; import Layout from '@/components/layout/Layout'; import { type AppProps } from 'next/app'; import Head from 'next/head'; -// import axios from 'axios'; import { Router } from 'next/router'; -import React, { type ReactElement, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; +import type { ReactElement } from 'react'; import '../styles/globals.css'; -import Login from './login'; export default function MyApp({ Component, pageProps }: AppProps): ReactElement { // const router = useRouter(); @@ -34,28 +33,6 @@ export default function MyApp({ Component, pageProps }: AppProps): ReactElement // }; // }, []); - // useEffect(() => { - // const url = new URL(window.location.href); - - // const postData = async () => { - // const code = url.searchParams.get('code'); - // try { - // await axios - // .post('/api/auth/42login', null, { - // params: { code: code }, - // }) - // .then(() => setLoading(false)) - // .then(() => router.push('/')); - // } catch (error) { - // console.error(error); - // } - // }; - - // if (url.asPath === '/auth/callback') { - // void postData(); - // setLoading(true); - // } - // }); const login = false; return ( <> diff --git a/pages/oauth/login/index.tsx b/pages/oauth/login/index.tsx new file mode 100644 index 0000000..c938019 --- /dev/null +++ b/pages/oauth/login/index.tsx @@ -0,0 +1,23 @@ +import Loading from '@/components/Loading'; +import useCallApi from '@/utils/useCallApi'; +import { useRouter } from 'next/router'; +import { useEffect } from 'react'; +import type { ReactElement } from 'react'; + +export default function Login(): ReactElement { + const callApi = useCallApi(); + const router = useRouter(); + + useEffect(() => { + const fetchData = async (): Promise => { + const config = { + url: router.asPath, + }; + await callApi(config); + await router.push('/'); + }; + void fetchData(); + }, []); + + return ; +}