Update auth-utils.ts
This commit is contained in:
@@ -27,7 +27,6 @@ export async function logoutUser(): Promise<void> {
|
|||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
try {
|
try {
|
||||||
// Try to logout on the server (if this fails, we still proceed with client logout)
|
|
||||||
await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/logout`, {
|
await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/logout`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -35,12 +34,10 @@ export async function logoutUser(): Promise<void> {
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
// Silently catch errors - we still want to proceed with local logout
|
|
||||||
console.warn('Server logout failed:', err);
|
console.warn('Server logout failed:', err);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('Error during server logout:', error);
|
console.warn('Error during server logout:', error);
|
||||||
// Continue with client-side logout regardless of server response
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user