25 lines
466 B
TypeScript
25 lines
466 B
TypeScript
import { useToast } from "primevue/usetoast";
|
|
import type IVAlert from "../alert/IVAlert.type.js";
|
|
|
|
export function useAlert() {
|
|
const toast = useToast();
|
|
|
|
const showAlert = ({
|
|
title = '',
|
|
description = '',
|
|
type = 'info',
|
|
closeable = true,
|
|
lifeTime,
|
|
}: IVAlert) => {
|
|
toast.add({
|
|
severity: type,
|
|
summary: title,
|
|
detail: description,
|
|
life: lifeTime,
|
|
closable: closeable,
|
|
})
|
|
}
|
|
|
|
return { showAlert}
|
|
}
|