fix: navbar refreshes auth state on navigation
Login button now correctly changes to Logout after login
This commit is contained in:
@@ -52,7 +52,7 @@ export default function Navbar() {
|
|||||||
link.href = data.data;
|
link.href = data.data;
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}, []);
|
}, [pathname]);
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
await fetch('/api/auth/logout', { method: 'POST', credentials: 'same-origin' });
|
await fetch('/api/auth/logout', { method: 'POST', credentials: 'same-origin' });
|
||||||
|
|||||||
Reference in New Issue
Block a user