freshyo/apps/admin-ui/services/notif-service/pending-navigation.ts
2026-10-29 23:04:42 +05:30

24 lines
709 B
TypeScript

/**
* Destination carried across a login boundary.
*
* A staff member can tap a push (new order, cancellation, complaint) while
* signed out, or before the stored session has been restored. The notification
* provider records the target href here instead of navigating; the login flow
* consumes it and lands on that screen instead of the dashboard.
*/
let pendingHref: string | null = null
export function setPendingHref(href: string): void {
pendingHref = href
}
/** Returns the pending href once, clearing it. */
export function takePendingHref(): string | null {
const href = pendingHref
pendingHref = null
return href
}
export function clearPendingHref(): void {
pendingHref = null
}