File tree Expand file tree Collapse file tree 5 files changed +54
-6
lines changed Expand file tree Collapse file tree 5 files changed +54
-6
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ import Google from '@/shared/assets/icons/google.svg';
66import tw from '@/shared/utills/tw' ;
77import Welcome from './Welcome' ;
88import { useState } from 'react' ;
9+ import { useAuthStore } from '@/shared/@store/auth' ;
910
1011function SocialLogin ( ) {
1112 const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
13+ const { user } = useAuthStore ( ) ;
1214
1315 const socialButtons = [
1416 {
@@ -33,8 +35,10 @@ function SocialLogin() {
3335
3436 // TODO: 백엔드 연동 로직 구현 필요
3537 const handleLogin = ( id : string ) => {
36- console . log ( id ) ;
37- setIsModalOpen ( true ) ;
38+ const preLoginPath = sessionStorage . getItem ( 'preLoginPath' ) ;
39+ console . log ( '경로, id' , preLoginPath , id ) ;
40+
41+ // useAuthStore.getState().loginWithProvider(id as 'naver' | 'kakao' | 'google');
3842 } ;
3943
4044 return (
@@ -54,7 +58,11 @@ function SocialLogin() {
5458 </ div >
5559
5660 { /* 웰컴 모달 (임시) */ }
57- < Welcome open = { isModalOpen } onClose = { ( ) => setIsModalOpen ( false ) } />
61+ < Welcome
62+ open = { isModalOpen }
63+ onClose = { ( ) => setIsModalOpen ( false ) }
64+ nickname = { user ?. nickname || '게스트' }
65+ />
5866 </ >
5967 ) ;
6068}
Original file line number Diff line number Diff line change @@ -10,16 +10,17 @@ import { useRouter } from 'next/navigation';
1010interface Props {
1111 open : boolean ;
1212 onClose : ( ) => void ;
13+ nickname : string ;
1314}
1415
15- function Welcome ( { open, onClose } : Props ) {
16+ function Welcome ( { open, onClose, nickname } : Props ) {
1617 const router = useRouter ( ) ;
1718
1819 return (
1920 < ModalLayout
2021 open = { open }
2122 onClose = { onClose }
22- title = " 환영합니다!"
23+ title = { ` 환영합니다, ${ nickname } 님!` }
2324 description = "바텐더 쑤리가 안내해드릴게요"
2425 buttons = {
2526 < >
Original file line number Diff line number Diff line change 1+ 'use client' ;
2+
3+ import { useEffect } from 'react' ;
4+ import { useRouter } from 'next/navigation' ;
5+ import { useAuthStore } from '@/shared/@store/auth' ;
6+ import Spinner from '@/shared/components/spinner/Spinner' ;
7+
8+ function Page ( ) {
9+ const router = useRouter ( ) ;
10+ const { user } = useAuthStore ( ) ;
11+
12+ useEffect ( ( ) => {
13+ if ( user ) {
14+ const prevPath = sessionStorage . getItem ( 'preLoginPath' ) || '/' ;
15+ router . push ( prevPath ) ;
16+ sessionStorage . removeItem ( 'preLoginPath' ) ;
17+ }
18+ } , [ user , router ] ) ;
19+ return (
20+ < div className = "page-layout max-w-824 flex-center" >
21+ < Spinner />
22+ </ div >
23+ ) ;
24+ }
25+ export default Page ;
Original file line number Diff line number Diff line change 1+ import { create } from 'zustand' ;
2+
3+ interface ModalState {
4+ welcomeOpen : boolean ;
5+ openModal : ( modal : keyof ModalState ) => void ;
6+ closeModal : ( modal : keyof ModalState ) => void ;
7+ }
8+
9+ export const useModalStore = create < ModalState > ( ( set ) => ( {
10+ welcomeOpen : false ,
11+
12+ openModal : ( modal ) => set ( { [ modal ] : true } ) ,
13+ closeModal : ( modal ) => set ( { [ modal ] : false } ) ,
14+ } ) ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ function HamburgerMenu() {
1414 < >
1515 < button
1616 type = "button"
17- className = "sm:hidden block stroke-white hover:stroke-white/80 w-[63px] "
17+ className = "sm:hidden block stroke-white hover:stroke-white/80"
1818 onClick = { ( e ) => handleClick ( e ) }
1919 aria-label = "메뉴 열기"
2020 aria-expanded = { isClicked }
You can’t perform that action at this time.
0 commit comments