Skip to content

Commit

Permalink
fix: useSearchParams 사용하는 컴포넌트 build 오류 수정 (suspense 추가)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyeongza committed Jun 24, 2024
1 parent d913ae8 commit f839969
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
20 changes: 11 additions & 9 deletions src/app/(iTracker)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { API_BASE_URL } from '@/shared/api/constants';
import { useToast } from '@/shared/components/shadcn/ui/use-toast';
import { useSearchParams } from 'next/navigation';
import { useEffect } from 'react';
import { Suspense, useEffect } from 'react';

export default function LoginPage() {
const params = useSearchParams();
Expand All @@ -23,13 +23,15 @@ export default function LoginPage() {
};

return (
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }}>
<button
onClick={handleButtonClick}
style={{ padding: '10px 20px', fontSize: '18px', borderRadius: '5px', cursor: 'pointer' }}
>
카카오톡 로그인
</button>
</div>
<Suspense>
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }}>
<button
onClick={handleButtonClick}
style={{ padding: '10px 20px', fontSize: '18px', borderRadius: '5px', cursor: 'pointer' }}
>
카카오톡 로그인
</button>
</div>
</Suspense>
);
}
8 changes: 6 additions & 2 deletions src/app/(iTracker)/oauth/redirected/kakao/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { useState, useEffect } from 'react';
import { useState, useEffect, Suspense } from 'react';
import { useRouter, useSearchParams } from 'next/navigation';
import { Loading } from '@/shared/components/Loading';
import { useToast } from '@/shared/components/shadcn/ui/use-toast';
Expand Down Expand Up @@ -35,5 +35,9 @@ export default function KakaoCallbackPage() {
}
}, [authCode, router, toast]);

return <Loading />;
return (
<Suspense>
<Loading />
</Suspense>
);
}

0 comments on commit f839969

Please sign in to comment.