Skip to content

Commit

Permalink
Merge pull request #128 from kakao-tech-campus-2nd-step3/fix-login-error
Browse files Browse the repository at this point in the history
Fix: window location으로 리다이렉트
  • Loading branch information
ppochaco authored Nov 7, 2024
2 parents d09bdd2 + 7ca7037 commit 7d0cf7f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
37 changes: 19 additions & 18 deletions src/pages/LoginPage/KakaoLoginButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import { Link } from 'react-router-dom'

import { Flex, Image, Text } from '@chakra-ui/react'

import KakaoSymbol from '@/assets/kakao-logo-symbol.svg'

export const KakaoLoginButton = () => {
const redirectURL = import.meta.env.DEV ? import.meta.env.VITE_LOGIN_URL : ''

const handleLogin = () => {
window.location.href = `${redirectURL}/api/user/login`
}

return (
<Link to={`${redirectURL}/api/user/login`}>
<Flex
background="kakao"
rounded="6px"
justifyContent="center"
alignItems="center"
height={10}
gap={3}
_hover={{ cursor: 'pointer' }}
>
<Image src={KakaoSymbol} width={5} />
<Text fontSize="14px" fontWeight="bold" color="rgba(0, 0, 0, 0.85)">
카카오 로그인
</Text>
</Flex>
</Link>
<Flex
background="kakao"
rounded="6px"
justifyContent="center"
alignItems="center"
height={10}
gap={3}
_hover={{ cursor: 'pointer' }}
onClick={handleLogin}
>
<Image src={KakaoSymbol} width={5} />
<Text fontSize="14px" fontWeight="bold" color="rgba(0, 0, 0, 0.85)">
카카오 로그인
</Text>
</Flex>
)
}
1 change: 0 additions & 1 deletion src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const router = createBrowserRouter([
element: <ProfileQuestionLayout />,
children: [{ path: '/profile-question', element: <ProfileQuestionPage /> }],
},
{ path: '/api/*' },
{
path: '*',
element: <ErrorPage />,
Expand Down

0 comments on commit 7d0cf7f

Please sign in to comment.