|
| 1 | +import { useEffect } from 'react'; |
| 2 | +import { useNavigate } from 'react-router'; |
| 3 | + |
1 | 4 | import * as s from './style.css'; |
2 | 5 |
|
3 | 6 | import SafeArea from '@/common/components/SafeArea'; |
| 7 | +import useGetIsLogin from '@/common/hooks/apis/useGetIsLogin'; |
| 8 | +import GoogleLogo from '@/libs/assets/GoogleLogo'; |
| 9 | +import KakaoLogo from '@/libs/assets/KakaoLogo'; |
4 | 10 |
|
5 | 11 | const LoginPage = () => { |
| 12 | + const navigate = useNavigate(); |
| 13 | + const { data: isLogin, isLoading } = useGetIsLogin(); |
| 14 | + |
| 15 | + useEffect(() => { |
| 16 | + // TODO: μλ μλ νμ΄μ§λ‘ |
| 17 | + if (isLogin) { |
| 18 | + navigate(-1); |
| 19 | + } |
| 20 | + }, [isLogin, navigate]); |
| 21 | + |
| 22 | + if (isLoading || isLogin) return null; |
| 23 | + |
6 | 24 | return ( |
7 | 25 | <SafeArea> |
8 | 26 | <div className={s.Container}> |
9 | | - <h1>μμ λ‘κ·ΈμΈ νμ΄μ§</h1> |
10 | | - <a href={`${import.meta.env.VITE_API_URL}/oauth2/authorization/kakao`}>μΉ΄μΉ΄μ€ λ‘κ·ΈμΈ</a> |
11 | | - <a href={`${import.meta.env.VITE_API_URL}/oauth2/authorization/google`}>κ΅¬κΈ λ‘κ·ΈμΈ</a> |
| 27 | + <p className={s.Label}>SNS κ³μ μΌλ‘ λ‘κ·ΈμΈνκΈ°</p> |
| 28 | + <div className={s.ButtonContainer}> |
| 29 | + {/* TODO: μ ν λ‘κ·ΈμΈ μΆκ° */} |
| 30 | + <a |
| 31 | + className={s.LoginButton({ src: 'google' })} |
| 32 | + href={`${import.meta.env.VITE_API_URL}/oauth2/authorization/google`} |
| 33 | + > |
| 34 | + <GoogleLogo /> |
| 35 | + Googleλ‘ λ‘κ·ΈμΈ |
| 36 | + </a> |
| 37 | + <a |
| 38 | + className={s.LoginButton({ src: 'kakao' })} |
| 39 | + href={`${import.meta.env.VITE_API_URL}/oauth2/authorization/kakao`} |
| 40 | + > |
| 41 | + <KakaoLogo /> |
| 42 | + μΉ΄μΉ΄μ€ν‘μΌλ‘ λ‘κ·ΈμΈ |
| 43 | + </a> |
| 44 | + </div> |
12 | 45 | </div> |
13 | 46 | </SafeArea> |
14 | 47 | ); |
|
0 commit comments