✨ feature: useAlert composable added
This commit is contained in:
parent
355802ed6b
commit
0f9d219eb6
24
src/components/composable/useAlert.ts
Normal file
24
src/components/composable/useAlert.ts
Normal file
|
@ -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}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user