Skip to content

Commit

Permalink
Merge branch 'hotfix' into KL-176/Banner
Browse files Browse the repository at this point in the history
  • Loading branch information
seoulyego committed Oct 16, 2024
2 parents 2714b70 + 6f9b40c commit 7d68396
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/pages/LogoutPage/LogoutPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ import useKyMutation from '@hooks/useKyMutation'
function LogoutPage() {
const isLogin = useLoginStore((state) => state.isLogin)
const setLogout = useLoginStore((state) => state.setLogout)
const { mutate } = useKyMutation(kyMethod.POST, 'logout', ['me'])
const { mutateAsync } = useKyMutation(kyMethod.POST, 'logout', ['me'])
const navigate = useNavigate()

useEffect(() => {
if (isLogin) {
setLogout()
mutate()
const logout = async () => {
if (isLogin) {
setLogout()
try {
await mutateAsync()
} catch (error) {
alert('로그아웃에 실패했습니다. 다시 시도해주세요.')
}
}
navigate('/')
}
navigate('/')

logout()
}, [])
}

Expand Down

0 comments on commit 7d68396

Please sign in to comment.