@@ -11,7 +11,7 @@ import type { ExperimentPostListFilters, ExperimentPostResponse } from '@/apis/p
1111import DefaultLayout from '@/components/layout/DefaultLayout/DefaultLayout' ;
1212import { queryKey } from '@/constants/queryKey' ;
1313import { API_URL } from '@/constants/url' ;
14- import { authOptions } from '@/lib/auth-utils' ;
14+ import { authOptions , isUnauthorizedUser } from '@/lib/auth-utils' ;
1515import { getQueryClient } from '@/lib/getQueryClient' ;
1616import { URLFilterSchema } from '@/schema/filter/URLFilterSchema' ;
1717import { getQueryParamsToString } from '@/utils/getQueryParamsString' ;
@@ -31,11 +31,12 @@ export default async function Home({ searchParams }: HomePageProps) {
3131 const fetchClient = createSSRFetchClient ( session ?. accessToken ) ;
3232 const hasQueryParams = Object . keys ( searchParams ) . length > 0 ;
3333
34- const initialUserInfo = session ?. role
35- ? await fetchClient . get < ParticipantResponse | ResearcherResponse > (
36- API_URL . me ( session . role . toLowerCase ( ) ) ,
37- )
38- : null ;
34+ const initialUserInfo =
35+ ! isUnauthorizedUser ( session ) && session ?. role
36+ ? await fetchClient . get < ParticipantResponse | ResearcherResponse > (
37+ API_URL . me ( session . role . toLowerCase ( ) ) ,
38+ )
39+ : null ;
3940
4041 const initialGender =
4142 initialUserInfo && isParticipantInfo ( initialUserInfo ) ? initialUserInfo . gender : undefined ;
@@ -63,7 +64,7 @@ export default async function Home({ searchParams }: HomePageProps) {
6364 } ,
6465 ) ;
6566
66- if ( session ?. role ) {
67+ if ( ! isUnauthorizedUser ( session ) && session ?. role ) {
6768 await queryClient . prefetchQuery ( {
6869 queryKey : queryKey . userInfo ( session . role ) ,
6970 queryFn : ( ) => Promise . resolve ( initialUserInfo ) ,
0 commit comments