Files
fotospiel-app/resources/js/guest-v2/lib/toast.ts
Codex Agent 298a8375b6
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Update guest v2 branding and theming
2026-02-03 15:18:44 +01:00

19 lines
446 B
TypeScript

export type GuestToastPayload = {
text: string;
type?: 'success' | 'error' | 'info';
action?: { label: string; onClick: () => void };
durationMs?: number;
};
export function pushGuestToast(detail: GuestToastPayload) {
if (typeof window === 'undefined') {
return;
}
try {
window.dispatchEvent(new CustomEvent('guest-toast', { detail }));
} catch (error) {
console.warn('Dispatching toast event failed', error);
}
}