1- import { useAuthStore } from '@/store/authStore' ;
2- import { Navigate , Route , Routes , useLocation } from 'react-router' ;
1+ import { Route , Routes , useLocation } from 'react-router' ;
32import Layout from '@/layouts/Layout' ;
43import Landing from '@/pages/landing/Landing' ;
54import Modal from '@/components/Modal' ;
@@ -25,22 +24,16 @@ import KaKaoRedirection from '@/components/KaKaoRedirection';
2524import { useSSE } from '@/hooks/useSSE' ;
2625import { useYotube } from '@/hooks/useYoutube' ;
2726import { useSpotifyAuth } from '@/hooks/useSpotifyAuth' ;
28- import { useEffect } from 'react' ;
2927import { useTokenExpired } from '@/hooks/useTokenRefresh' ;
3028import UserProfile from '@/pages/user/UserProfile' ;
29+ import PublicRoute from '@/routes/PublicRoute' ;
3130
3231function App ( ) {
3332 const location = useLocation ( ) ;
3433
35- const { isAuthenticated } = useAuthStore ( ) ;
3634 const { isRequestSendingSheetOpen, isRequestReceivingSheetOpen } = useSheetStore ( ) ;
3735
38- const spotifyAuth = useSpotifyAuth ( ) ;
39- useEffect ( ( ) => {
40- if ( isAuthenticated ) {
41- console . log ( 'Spotify Auth Initialized:' , spotifyAuth ) ;
42- }
43- } , [ isAuthenticated ] ) ;
36+ useSpotifyAuth ( ) ;
4437
4538 useSSE ( ) ; // SSE연결
4639 useTokenExpired ( ) ; // 토큰 만료 체크
@@ -53,19 +46,11 @@ function App() {
5346 < AnimatedLayout >
5447 < Routes location = { location } >
5548 < Route path = "/" element = { < Layout /> } >
56- < Route
57- index
58- element = { isAuthenticated ? < Navigate to = "/home" replace /> : < Landing /> }
59- />
60-
61- < Route
62- path = "/login"
63- element = { isAuthenticated ? < Navigate to = "/home" replace /> : < Login /> }
64- />
65- < Route
66- path = "/signup"
67- element = { isAuthenticated ? < Navigate to = "/home" replace /> : < SignUp /> }
68- />
49+ < Route element = { < PublicRoute /> } >
50+ < Route index element = { < Landing /> } />
51+ < Route path = "/login" element = { < Login /> } />
52+ < Route path = "/signup" element = { < SignUp /> } />
53+ </ Route >
6954
7055 { /* PrivateRoute 적용 */ }
7156 < Route element = { < PrivateRoute /> } >
0 commit comments