2026-03-19 11:42:17 +01:00

25 lines
576 B
TypeScript

// frontend\src\components\ui\notify.ts
'use client'
import type { Toast } from './ToastProvider'
import { useToast } from './ToastProvider'
// Hook-Wrapper (komfortabel)
export function useNotify() {
const { push, remove, clear } = useToast()
const base = (type: Toast['type']) => (title: string, message?: string, opts?: Partial<Omit<Toast, 'id' | 'type'>>) =>
push({ type, title, message, ...opts })
return {
push,
remove,
clear,
success: base('success'),
error: base('error'),
info: base('info'),
warning: base('warning'),
}
}