diff --git a/src/components/composable/useAlert.ts b/src/components/composable/useAlert.ts new file mode 100644 index 0000000..af7be43 --- /dev/null +++ b/src/components/composable/useAlert.ts @@ -0,0 +1,24 @@ +import { useToast } from "primevue/usetoast"; +import type IVAlert from "@/components/alert/IVAlert.type"; + +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} +}