From b069a625049fca17943e47ce982ff831d6b4b295 Mon Sep 17 00:00:00 2001 From: jerry Date: Tue, 3 Dec 2024 22:01:59 +0900 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4?= =?UTF-8?q?=ED=86=A1=EC=9D=84=20=ED=86=B5=ED=95=B4=20=EC=99=B8=EB=B6=80=20?= =?UTF-8?q?=EB=B8=8C=EB=9D=BC=EC=9A=B0=EC=A0=80=20=ED=98=B8=EC=B6=9C=20?= =?UTF-8?q?=EC=8B=9C,=20=EC=9B=90=EB=9E=98=20URL=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/_app.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 018c8cffe..9a46d23e3 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -83,7 +83,9 @@ function MyApp({ Component, pageProps }: AppProps) { if (useragt.match(/kakaotalk/i)) { // MEMO: 카카오톡 외부브라우저로 호출 - location.href = 'kakaotalk://web/openExternal?url=' + encodeURIComponent(target_url); + const encodedReturnUrl = encodeURIComponent(target_url); + + location.href = `kakaotalk://web/openExternal?url=${encodedReturnUrl}&returnUrl=${encodedReturnUrl}`; } else if ( useragt.match( /inapp|naver|snapchat|wirtschaftswoche|thunderbird|instagram|everytimeapp|whatsApp|electron|wadiz|aliapp|zumapp|iphone(.*)whale|android(.*)whale|kakaostory|band|twitter|DaumApps|DaumDevice\/mobile|FB_IAB|FB4A|FBAN|FBIOS|FBSS|trill|SamsungBrowser\/[^1]/i, From 8a5dc0db10d90c3b39a4d436cbb6158ee18e1fd1 Mon Sep 17 00:00:00 2001 From: jerry Date: Tue, 3 Dec 2024 22:14:34 +0900 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=EC=99=B8=EB=B6=80=20=EB=B8=8C?= =?UTF-8?q?=EB=9D=BC=EC=9A=B0=EC=A0=80=EC=97=90=EC=84=9C=20URL=20=ED=8C=8C?= =?UTF-8?q?=EB=9D=BC=EB=AF=B8=ED=84=B0=EB=A5=BC=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=9B=84=20?= =?UTF-8?q?=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89=ED=8A=B8=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/oauth/OAuthCallback.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/auth/oauth/OAuthCallback.tsx b/src/components/auth/oauth/OAuthCallback.tsx index d466f41a9..78f08ea54 100644 --- a/src/components/auth/oauth/OAuthCallback.tsx +++ b/src/components/auth/oauth/OAuthCallback.tsx @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; -import { colors } from '@sopt-makers/colors'; import Link from 'next/link'; import { useRouter } from 'next/router'; import { FC, useEffect, useState } from 'react'; @@ -43,8 +42,15 @@ const OAuthCallback: FC = ({ url }) => { } if (!accessToken) { - lastUnauthorized.setPath(url.href); + const returnUrl = new URLSearchParams(window.location.search).get('returnUrl'); + + if (returnUrl) { + lastUnauthorized.setPath(decodeURIComponent(returnUrl)); + } else { + lastUnauthorized.setPath(url.href); + } location.href = playgroundLink.login(); + return; } From b142b9b9cdb851dc87f245efe87eacd6f6cb27b4 Mon Sep 17 00:00:00 2001 From: jerry Date: Tue, 3 Dec 2024 22:45:39 +0900 Subject: [PATCH 3/9] =?UTF-8?q?test:=20=EC=84=B8=EC=85=98=20=EC=8A=A4?= =?UTF-8?q?=ED=86=A0=EB=A6=AC=EC=A7=80=EC=97=90=20=EB=93=A4=EC=96=B4?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20path=20=ED=99=95=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/intro/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx index 8c1da2de9..082529f04 100644 --- a/src/components/intro/index.tsx +++ b/src/components/intro/index.tsx @@ -1,5 +1,6 @@ import { FC } from 'react'; +import useLastUnauthorized from '@/components/auth/util/useLastUnauthorized'; import CatchPhraseSection from '@/components/intro/sections/CatchPhrase'; import Entry from '@/components/intro/sections/Entry'; import Footer from '@/components/intro/sections/Footer'; @@ -9,8 +10,11 @@ import ValueSection from '@/components/intro/sections/ValueSection'; interface IntroProps {} const Intro: FC = ({}) => { + const lastUnauthorized = useLastUnauthorized(); + return ( <> +

path: {lastUnauthorized.popPath()}

From fc61ac724c308a0ab2e76e770245bafb4db7b9d2 Mon Sep 17 00:00:00 2001 From: jerry Date: Tue, 3 Dec 2024 22:47:13 +0900 Subject: [PATCH 4/9] =?UTF-8?q?test:=20=EA=B8=B0=EB=B3=B8=EA=B0=92=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/intro/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx index 082529f04..12a56fb1b 100644 --- a/src/components/intro/index.tsx +++ b/src/components/intro/index.tsx @@ -14,7 +14,7 @@ const Intro: FC = ({}) => { return ( <> -

path: {lastUnauthorized.popPath()}

+

path: {lastUnauthorized.popPath() ?? 'none'}

From 63a1b203f8dd08457bd5270f35e5f05e47c7343b Mon Sep 17 00:00:00 2001 From: jerry Date: Tue, 3 Dec 2024 22:51:57 +0900 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20=EB=B0=B0=ED=8F=AC=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95=20path=20=EA=B0=92=20clientSide?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/intro/index.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx index 12a56fb1b..7af1ffea5 100644 --- a/src/components/intro/index.tsx +++ b/src/components/intro/index.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react'; +import { FC, useEffect, useState } from 'react'; import useLastUnauthorized from '@/components/auth/util/useLastUnauthorized'; import CatchPhraseSection from '@/components/intro/sections/CatchPhrase'; @@ -6,15 +6,23 @@ import Entry from '@/components/intro/sections/Entry'; import Footer from '@/components/intro/sections/Footer'; import Login from '@/components/intro/sections/Login'; import ValueSection from '@/components/intro/sections/ValueSection'; +import { isClientSide } from '@/utils'; interface IntroProps {} const Intro: FC = ({}) => { const lastUnauthorized = useLastUnauthorized(); + const [path, setPath] = useState(null); + + useEffect(() => { + if (isClientSide()) { + setPath(lastUnauthorized.popPath() ?? 'none'); + } + }, [lastUnauthorized]); return ( <> -

path: {lastUnauthorized.popPath() ?? 'none'}

+

path: {path}

From ebb39a69c6f25db5c6febb15acde7b272cc76f13 Mon Sep 17 00:00:00 2001 From: jerry Date: Tue, 3 Dec 2024 23:31:02 +0900 Subject: [PATCH 6/9] =?UTF-8?q?chore:=20dependency=EC=97=90=20path=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/intro/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx index 7af1ffea5..16944df6c 100644 --- a/src/components/intro/index.tsx +++ b/src/components/intro/index.tsx @@ -18,7 +18,7 @@ const Intro: FC = ({}) => { if (isClientSide()) { setPath(lastUnauthorized.popPath() ?? 'none'); } - }, [lastUnauthorized]); + }, [lastUnauthorized, path]); return ( <> From a4b78fb9fa0d040efd58a5074e1e5217ace68962 Mon Sep 17 00:00:00 2001 From: jerry Date: Tue, 3 Dec 2024 23:44:04 +0900 Subject: [PATCH 7/9] =?UTF-8?q?test:=20=EB=94=94=EB=B2=84=EA=B9=85=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/intro/index.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx index 16944df6c..28840efdf 100644 --- a/src/components/intro/index.tsx +++ b/src/components/intro/index.tsx @@ -16,9 +16,16 @@ const Intro: FC = ({}) => { useEffect(() => { if (isClientSide()) { - setPath(lastUnauthorized.popPath() ?? 'none'); + const poppedPath = lastUnauthorized.popPath(); + console.log('Popped path:', poppedPath); + + setPath(poppedPath ?? 'none'); } - }, [lastUnauthorized, path]); + }, [lastUnauthorized]); + + useEffect(() => { + console.log('Current path state:', path); + }, [path]); return ( <> From 2c9842ad879a23c43729ba2bb8ac0b310592925c Mon Sep 17 00:00:00 2001 From: jerry Date: Mon, 9 Dec 2024 15:55:31 +0900 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20popPath=20=ED=95=9C=20=EB=B2=88=20?= =?UTF-8?q?=EC=88=98=ED=96=89=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/intro/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx index 28840efdf..150978a9a 100644 --- a/src/components/intro/index.tsx +++ b/src/components/intro/index.tsx @@ -6,6 +6,7 @@ import Entry from '@/components/intro/sections/Entry'; import Footer from '@/components/intro/sections/Footer'; import Login from '@/components/intro/sections/Login'; import ValueSection from '@/components/intro/sections/ValueSection'; +import { useRunOnce } from '@/hooks/useRunOnce'; import { isClientSide } from '@/utils'; interface IntroProps {} @@ -14,7 +15,7 @@ const Intro: FC = ({}) => { const lastUnauthorized = useLastUnauthorized(); const [path, setPath] = useState(null); - useEffect(() => { + useRunOnce(() => { if (isClientSide()) { const poppedPath = lastUnauthorized.popPath(); console.log('Popped path:', poppedPath); From 28183c84659771c90fcda77f4de688568764047f Mon Sep 17 00:00:00 2001 From: jerry Date: Mon, 9 Dec 2024 16:09:02 +0900 Subject: [PATCH 9/9] =?UTF-8?q?chore:=20=EB=94=94=EB=B2=84=EA=B9=85=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20-=20SessionStorage=EC=97=90=20path=20?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EA=B0=80=EB=8A=94=20=EA=B2=83=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/intro/index.tsx | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx index 150978a9a..8c1da2de9 100644 --- a/src/components/intro/index.tsx +++ b/src/components/intro/index.tsx @@ -1,36 +1,16 @@ -import { FC, useEffect, useState } from 'react'; +import { FC } from 'react'; -import useLastUnauthorized from '@/components/auth/util/useLastUnauthorized'; import CatchPhraseSection from '@/components/intro/sections/CatchPhrase'; import Entry from '@/components/intro/sections/Entry'; import Footer from '@/components/intro/sections/Footer'; import Login from '@/components/intro/sections/Login'; import ValueSection from '@/components/intro/sections/ValueSection'; -import { useRunOnce } from '@/hooks/useRunOnce'; -import { isClientSide } from '@/utils'; interface IntroProps {} const Intro: FC = ({}) => { - const lastUnauthorized = useLastUnauthorized(); - const [path, setPath] = useState(null); - - useRunOnce(() => { - if (isClientSide()) { - const poppedPath = lastUnauthorized.popPath(); - console.log('Popped path:', poppedPath); - - setPath(poppedPath ?? 'none'); - } - }, [lastUnauthorized]); - - useEffect(() => { - console.log('Current path state:', path); - }, [path]); - return ( <> -

path: {path}