Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
19 lines
649 B
TypeScript
19 lines
649 B
TypeScript
import { CLEAR_REFRESH_SESSION_HEADER, CLEAR_REFRESH_SESSION_PATH } from '@/lib/refreshSessionCookie'
|
|
|
|
const CLEAR_SESSION_TIMEOUT_MS = 2500
|
|
|
|
/** Same-origin cookie expiry. Must run even when Nest logout failed. */
|
|
export const expireRefreshSessionOnThisOrigin = async (): Promise<void> => {
|
|
try {
|
|
await fetch(CLEAR_REFRESH_SESSION_PATH, {
|
|
method: 'POST',
|
|
credentials: 'same-origin',
|
|
headers: { [CLEAR_REFRESH_SESSION_HEADER]: '1' },
|
|
cache: 'no-store',
|
|
signal: AbortSignal.timeout(CLEAR_SESSION_TIMEOUT_MS),
|
|
})
|
|
} catch {
|
|
// Local storage is still wiped by AuthContext; this is cookie best-effort.
|
|
}
|
|
}
|