Skip to content

Commit

Permalink
Merge pull request #11 from wafflestudio/feat/login
Browse files Browse the repository at this point in the history
FEAT: 구글 로그인 수정
  • Loading branch information
Joeyoojin authored Feb 7, 2025
2 parents 047a2ee + 3667d20 commit 08c1292
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
40 changes: 38 additions & 2 deletions src/pages/OAuthCallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,49 @@ const OAuthCallback = () => {

const { data, isLoading } = useGetRequestWithoutToken<AuthResponse>(
['google-code'],
`/api/v1/auth/google/callback?code=${code}`,
`/api/v1/auth/google/callback?code=${code}&profile=${import.meta.env.VITE_PROFILE}`,
{
refetchOnWindowFocus: true,
}
);

if (isLoading) return <div>Loading...</div>;
if (isLoading) {
return (
<div className="flex h-full flex-col items-center justify-center">
<svg
className="h-12 w-12 animate-spin text-pointColor"
viewBox="0 0 50 50"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle
cx="25"
cy="25"
r="20"
stroke="currentColor"
strokeWidth="4"
strokeDasharray="100"
strokeLinecap="round"
opacity="0.3"
/>
<circle
cx="25"
cy="25"
r="20"
stroke="currentColor"
strokeWidth="4"
strokeDasharray="100"
strokeDashoffset="75"
strokeLinecap="round"
/>
</svg>

<p className="mt-4 animate-pulse text-lg font-medium text-gray-600">
로그인 중...
</p>
</div>
);
}

if (data) {
setAccessToken(data.access_token);
Expand Down
1 change: 0 additions & 1 deletion src/route/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Home from '@/pages/Home.tsx';
import Landing from '@/pages/Landing.tsx';
import OAuthCallback from '@/pages/OAuthCallback.tsx';
import SignUp from '@/pages/SignUp.tsx';
import Test from '@/pages/Test.tsx';
import ProtectedRoute from '@/route/ProtectedRoute.tsx';

export const router = createBrowserRouter([
Expand Down

0 comments on commit 08c1292

Please sign in to comment.