1
0
mirror of https://github.com/MultiMote/niimblue synced 2026-01-19 19:37:11 +03:00
Files
niimblue/src/utils/toasts.ts
2024-10-18 22:57:21 +03:00

23 lines
477 B
TypeScript

import Toastify from "toastify-js";
import { z } from "zod";
export class Toasts {
static error(e: any) {
Toastify({
text: `${e}`,
gravity: "bottom",
duration: 5000,
className: "toast-danger",
}).showToast();
}
static zodErrors(e: any, prefix: string) {
if (e instanceof z.ZodError) {
console.error(e);
e.issues.forEach((i) => {
this.error(`${prefix} "${i.path.join("→")}" ${i.message}`);
});
}
}
}