From 0f9d219eb63f5c77d3d2ba4b85a6dc3b48f1b7df Mon Sep 17 00:00:00 2001 From: Paul Valerie GOMA Date: Sun, 27 Jul 2025 09:46:45 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feature:=20useAlert=20composable=20?= =?UTF-8?q?added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/composable/useAlert.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/components/composable/useAlert.ts 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} +}