You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
577 B
24 lines
577 B
'use client'
|
|
|
|
import { Routes } from '@/config/routes'
|
|
import { signOut, useSession } from 'next-auth/react'
|
|
import { useRouter } from 'next/navigation'
|
|
import { useEffect } from 'react'
|
|
|
|
export default function Logout() {
|
|
const session = useSession()
|
|
const router = useRouter()
|
|
useEffect(() => {
|
|
if (session.status === 'authenticated') {
|
|
signOut()
|
|
} else {
|
|
router.push(Routes.login)
|
|
}
|
|
}, [router, session.status])
|
|
|
|
return (
|
|
<div className='text-center min-h-screen flex items-center justify-center'>
|
|
Logging out...
|
|
</div>
|
|
)
|
|
}
|