♻️ refactor: useAlert composable updated

This commit is contained in:
Paul Valerie GOMA 2025-08-03 04:28:04 +02:00
parent 38dfcfe794
commit ef57a78a03

View File

@ -1,25 +1,24 @@
import { useToast } from "primevue/usetoast"; import { useToast } from "primevue/usetoast";
import type IVAlert from "@/components/alert/IVAlert.type.js"; import type IVAlert from "../alert/IVAlert.type.js";
export function useAlert() { export function useAlert() {
const toast = useToast();
const showAlert = ({ const showAlert = ({
title = '', title = '',
description = '', description = '',
type = 'info', type = 'info',
closeable = true, closeable = true,
lifeTime, lifeTime,
}: IVAlert) => { }: IVAlert) => {
const toast = useToast();
toast.add({ toast.add({
severity: type, severity: type,
summary: title, summary: title,
detail: description, detail: description,
life: lifeTime, life: lifeTime,
closable: closeable, closable: closeable,
}); })
}; }
return { showAlert }; return { showAlert}
} }