Add shared empty states, customer product filters, and SSO handoff across dashboards.
Standardize list empty UI, searchable country fields, customer-products filter row, password/login polish, and one-time business dashboard handoff from the customer app. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
832ac32a09
commit
f8a9a28346
@@ -0,0 +1,32 @@
|
||||
import { consumeHandoff } from '../services/authService'
|
||||
import type { LoginResponse } from '../types/auth'
|
||||
|
||||
let inFlight: Promise<LoginResponse | null> | null = null
|
||||
|
||||
function takeHandoffTicketFromUrl(): string | null {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
const ticket = params.get('handoff')?.trim()
|
||||
if (!ticket) return null
|
||||
|
||||
params.delete('handoff')
|
||||
const query = params.toString()
|
||||
const next = `${window.location.pathname}${query ? `?${query}` : ''}${window.location.hash}`
|
||||
window.history.replaceState({}, '', next)
|
||||
return ticket
|
||||
}
|
||||
|
||||
/** Consumes `?handoff=` at most once per page load (safe under React Strict Mode). */
|
||||
export function completeHandoffIfPresent(): Promise<LoginResponse | null> {
|
||||
if (!inFlight) {
|
||||
inFlight = (async () => {
|
||||
const ticket = takeHandoffTicketFromUrl()
|
||||
if (!ticket) return null
|
||||
try {
|
||||
return await consumeHandoff(ticket)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
})()
|
||||
}
|
||||
return inFlight
|
||||
}
|
||||
Reference in New Issue
Block a user