Files
fotospiel-app/resources/js/guest/queue/notify.ts
2025-09-08 14:03:43 +02:00

12 lines
376 B
TypeScript

export function notify(text: string, type: 'success'|'error') {
// Lazy import to avoid cycle
import('../components/ToastHost').then(({ useToast }) => {
try {
// This only works inside React tree; for SW-triggered, we fallback
const evt = new CustomEvent('guest-toast', { detail: { text, type } });
window.dispatchEvent(evt);
} catch {}
});
}