Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/page/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useOverlayModal } from '@/common/hook/useOverlayModal';
import LoginModal from '@/common/component/LoginModal/LoginModal';
import ScrollSection from '@/page/home/ScrollSection/ScrollSection';
import type { AnimationImporter } from '@/page/home/type/lottieType';
import { useAuthStore } from '@/store/useAuthStore';

const animationImporters = [
() => import('@/assets/lottie/mandalart.json'),
Expand All @@ -22,7 +23,14 @@ const Home = () => {
const end = useFadeInOnView<HTMLDivElement>();
const { openModal, closeModal } = useOverlayModal();

const handleOpenLogin = () => openModal(<LoginModal onClose={closeModal} />);
const user = useAuthStore((state) => state.user);

const handleOpenLogin = () => {
if (user) {
return;
}
openModal(<LoginModal onClose={closeModal} />);
};

return (
<div className={HomeContainer}>
Expand Down
5 changes: 2 additions & 3 deletions src/page/intro/Intro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { useLocation, useNavigate } from 'react-router-dom';
import * as styles from '@/page/intro/Intro.css';
import { PATH } from '@/route';

type PageStateType = 'MANDALART' | 'CORE_GOAL' | 'SUB_GOALS';
type PageStateType = 'MANDALART' | 'CORE_GOAL' | 'SUB_GOAL';

const ROUTE_BY_STATE: Record<PageStateType, string> = {
MANDALART: PATH.TODO,
CORE_GOAL: PATH.TODO_UPPER,
SUB_GOALS: PATH.TODO_LOWER,
SUB_GOAL: PATH.TODO_LOWER,
};

const MESSAGE = {
Expand All @@ -33,7 +33,6 @@ const Intro = () => {

const handleGoTodo = () => {
if (!pageState) {
navigate(PATH.TODO);
return;
}
navigate(ROUTE_BY_STATE[pageState]);
Expand Down
22 changes: 6 additions & 16 deletions src/page/signup/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import { useSignUpForm } from '@/page/signup/hook/useSignUpForm';
import { PATH } from '@/route';
import { usePostSignUp } from '@/api/domain/signup/hook/usePostSignup';
import type { SignupRequest } from '@/api/domain/signup/type/SignupRequest';
import getGoogleAuthCode from '@/api/auth/googleLogin/util/getGoogleAuthCode';
import getAccessToken from '@/api/auth/googleLogin/util/getAccessToken';

const SIGNUP_MESSAGE = '회원가입 후 NiNE DOT를 만나보세요!';
const FIT_INFO_MESSAGE = '내 성향을 선택하고 맞춤형 목표 추천을 받아보세요';
const PERSONAL_INFO_AGREEMENT = '(필수) 개인정보 수집 및 이용약관 동의';
Expand Down Expand Up @@ -49,22 +46,15 @@ const SignUp = () => {
};

signUp(payload, {
onSuccess: async () => {
try {
const code = getGoogleAuthCode();
if (code) {
const data = await getAccessToken(code);
if (data.accessToken) {
localStorage.setItem('accessToken', data.accessToken);
}
}
} catch (e) {
console.error('토큰 교환 실패:', e);
onSuccess: (data) => {
if (data.accessToken) {
localStorage.setItem('accessToken', data.accessToken);
}

navigate(PATH.INTRO, { state: { pageState: 'MANDALART' } });
},
onError: () => {},
onError: () => {
console.error('회원가입 실패');
},
});
};

Expand Down
2 changes: 1 addition & 1 deletion src/shared/component/Layout/layoutHeader/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import UserModal from '@/common/component/UserModal/UserModal';
import { useAuthStore } from '@/store/useAuthStore';

const MENUS = [
{ label: '나의 할 일', path: PATH.TODO },
{ label: '나의 할 일', path: PATH.TODO_MY },
{ label: '나의 만다라트', path: PATH.MANDAL },
{ label: '나의 히스토리', path: PATH.HISTORY },
];
Expand Down
Loading