-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.tsx
More file actions
36 lines (31 loc) · 1009 Bytes
/
index.tsx
File metadata and controls
36 lines (31 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import PageLoading from '@/components/PageLoading'
import SolidButton from '@/components/SolidButton'
import { useKakaoAuth } from '@/hooks/useKakaoAuth'
import { useEffect } from 'react'
import { Link, useSearchParams } from 'react-router-dom'
export default function AuthCallback() {
const [searchParams] = useSearchParams()
const authorizationCode = searchParams.get('code')
const { isLoading, error, handleKakaoLogin } = useKakaoAuth()
useEffect(() => {
if (authorizationCode) {
handleKakaoLogin(authorizationCode)
}
}, [authorizationCode])
if (error) {
return (
<main className="main-container content-padding justify-between">
<p className="mb-4 text-red-500">{error}</p>
<Link to="/">
<SolidButton variant="primary" size="medium" className="rounded-full">
로그인 페이지로 돌아가기
</SolidButton>
</Link>
</main>
)
}
if (isLoading) {
return <PageLoading />
}
return null
}