Skip to content

Commit

Permalink
feat: apply callbackUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
hyesungoh committed Mar 16, 2024
1 parent 676eb6a commit 28f4f42
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/sideMenu/MenuSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function MenuSection() {
label: '로그아웃',
action: () => {
// 실 환경에서 되는지 체크
logOutHandler();
logOutHandler({ callbackUrl: '/' });
router.replace('/');
},
},
Expand Down
6 changes: 2 additions & 4 deletions src/features/home/KakaoLoginButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const KakaoLoginButton = () => {
if (status === 'authenticated') {
return (
<div css={KakaoLoginWrapper}>
<button type="button" onClick={logOutHandler}>
<button type="button" onClick={() => logOutHandler()}>
로그아웃
</button>
</div>
Expand All @@ -23,7 +23,7 @@ const KakaoLoginButton = () => {
return (
<div css={KakaoLoginWrapper}>
이미 질문폼이 있다면?
<button type="button" css={KakaoLoginButtonCss} onClick={loginHandler}>
<button type="button" css={KakaoLoginButtonCss} onClick={() => loginHandler({ callbackUrl: '/gallery' })}>
로그인하고 결과 보기
</button>
</div>
Expand All @@ -32,13 +32,11 @@ const KakaoLoginButton = () => {

const KakaoLoginWrapper = css`
${BODY_1};
line-height: 24px;
color: ${colors.gray_400};
& * {
${BODY_1};
color: ${colors.gray_400};
}
Expand Down
10 changes: 0 additions & 10 deletions src/pages/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
import { type ReactElement } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { css, type Theme } from '@emotion/react';

import Logo from '~/assets/Logo';
import LayoutPaddingTo23 from '~/components/layout/LayoutPaddingTo23';
import SEO from '~/components/SEO/SEO';
import ConditionalCtaLink from '~/features/home/ConditionalCtaLink';
import KakaoLoginButton from '~/features/home/KakaoLoginButton';
import useKakaoLogin from '~/hooks/auth/useKakaoLogin';
import useDidUpdate from '~/hooks/lifeCycle/useDidUpdate';
import { HEAD_2_BOLD } from '~/styles/typo';

export default function Home() {
const router = useRouter();
const { status } = useKakaoLogin();

useDidUpdate(() => {
status === 'authenticated' && router.push('/gallery');
}, [status]);

return (
<>
<SEO />
Expand Down

0 comments on commit 28f4f42

Please sign in to comment.