Fix logout
This commit is contained in:
parent
82550e09a7
commit
bd7ec3ddde
2 changed files with 9 additions and 2 deletions
|
@ -1,7 +1,14 @@
|
|||
'use client';
|
||||
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export default function Page() {
|
||||
const router = useRouter();
|
||||
router.push('/');
|
||||
|
||||
useEffect(() => {
|
||||
router.push('/');
|
||||
}, []);
|
||||
|
||||
return <></>;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function middleware(req: NextRequest) {
|
|||
return res;
|
||||
}
|
||||
|
||||
if (isAuth && req.nextUrl.pathname.includes('logout')) {
|
||||
if (isAuth && req.nextUrl.pathname === '/logout') {
|
||||
res.cookies.set('token', '', {
|
||||
path: '/',
|
||||
expires: new Date(0)
|
||||
|
|
Loading…
Add table
Reference in a new issue