diff --git a/src/app/auth/callback/page.tsx b/src/app/auth/callback/page.tsx index fe8f90b..2d1073c 100644 --- a/src/app/auth/callback/page.tsx +++ b/src/app/auth/callback/page.tsx @@ -13,19 +13,20 @@ export default function LoginCheck() { const state = searchParams.get('state') const sendUserHomeOrStart = (userState: string) => { - if (userState == 'GUEST') router.push('/start') - if (userState == 'MEMBER') router.push('/home') + if (userState === 'GUEST') router.push('/start') + if (userState === 'MEMBER') router.push('/home') } const getUserData = async (socialType: string, sendDataArr: SendData[]) => { let url: string = `https://cnergy.p-e.kr/v1/oauth/login/${socialType}?` - for (let i = 0; i < sendDataArr.length; i++) { - if (i == 0) { + for (let i = 0; i < sendDataArr.length; i += 1) { + if (i === 0) { url += `${sendDataArr[i].name}=${sendDataArr[i].value}` - continue } - url += `&${sendDataArr[i].name}=${sendDataArr[i].value}` + if (i !== 0) { + url += `&${sendDataArr[i].name}=${sendDataArr[i].value}` + } } try { @@ -39,7 +40,7 @@ export default function LoginCheck() { const data = await res.json() - console.log('reponse Data', data) + // console.log('reponse Data', data) // 토근 설정 localStorage.setItem('accessToken', data.data.accessToken) diff --git a/src/app/components/Oauth/OauthBtn.tsx b/src/app/components/Oauth/OauthBtn.tsx index 47fe7aa..61442b5 100644 --- a/src/app/components/Oauth/OauthBtn.tsx +++ b/src/app/components/Oauth/OauthBtn.tsx @@ -1,37 +1,30 @@ import { useRouter } from 'next/navigation' import { OauthBtnProps } from './type' -export default function OauthBtn(data: OauthBtnProps) { +export default function OauthBtn({ auth_uri, type, text }: OauthBtnProps) { const router = useRouter() const handleSocialLogin = async () => { - router.push(`${data.auth_uri}`) + router.push(`${auth_uri}`) } + let btnStyle: string = '' + + if (type === 'kakao') btnStyle = 'bg-[#FFE819]' + if (type === 'naver') btnStyle = 'bg-[#03C75A]' + if (type === 'google') btnStyle = 'bg-white border' + return ( ) } diff --git a/src/app/components/Oauth/SocialTypeData.ts b/src/app/components/Oauth/SocialTypeData.ts index 813f8da..23d7f1e 100644 --- a/src/app/components/Oauth/SocialTypeData.ts +++ b/src/app/components/Oauth/SocialTypeData.ts @@ -1,6 +1,6 @@ import { OauthBtnData } from './type' -export const social_types: OauthBtnData[] = [ +export const socialTypes: OauthBtnData[] = [ { id: 1, type: 'kakao', @@ -18,6 +18,5 @@ export const social_types: OauthBtnData[] = [ type: 'google', text: '구글', auth_uri: 'https://cnergy.p-e.kr/v1/oauth/google', - style: 'border', }, ] diff --git a/src/app/components/Oauth/type.ts b/src/app/components/Oauth/type.ts index 617f8cc..2b54395 100644 --- a/src/app/components/Oauth/type.ts +++ b/src/app/components/Oauth/type.ts @@ -3,7 +3,6 @@ export interface OauthBtnData { type: string text: string auth_uri: string - style?: string } export type OauthBtnProps = Omit diff --git a/src/app/page.tsx b/src/app/page.tsx index 98ae20a..f815673 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -5,7 +5,7 @@ import { motion } from 'framer-motion' import SplashLogo from '@/components/Icons/SplashLogo' import SplashTop from '@/components/Icons/SplashTop' import SplashBottom from '@/components/Icons/SplashBottom' -import { social_types } from './components/Oauth/SocialTypeData' +import { socialTypes } from './components/Oauth/SocialTypeData' import OauthBtn from './components/Oauth/OauthBtn' export default function Home() { @@ -47,7 +47,7 @@ export default function Home() { - {social_types && - social_types.map((socialData) => { + {socialTypes && + socialTypes.map((socialData) => { return ( ) })}