mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-05-18 20:08:19 +00:00
fix: add keepalive to logout fetch — prevents session lock orphan
The logout POST to /auth/logout was getting cancelled when the page navigated to /login before the fetch completed. keepalive: true ensures the request survives page unload so the Redis session lock is released. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -119,6 +119,7 @@ export const AuthProvider = ({ children }: AuthProviderProps) => {
|
|||||||
await fetch(`${apiUrl}/auth/logout`, {
|
await fetch(`${apiUrl}/auth/logout`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { Authorization: `Bearer ${token}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
keepalive: true, // survives page navigation — ensures session unlock completes
|
||||||
signal: AbortSignal.timeout(5000),
|
signal: AbortSignal.timeout(5000),
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user