Files
Endoleap/src/lib/notifications.ts
T

11 lines
460 B
TypeScript

"use client";
import { toast } from "sonner";
/** Application adapter. Domain/editor packages must not import Sonner. */
export type Notification = { id: string; title: string; description?: string; level?: "info" | "success" | "warning" | "error" };
export function notify({ id, title, description, level = "info" }: Notification) {
return toast[level](title, { id, description });
}
export function dismissNotification(id: string) { toast.dismiss(id); }