1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

change project

This commit is contained in:
MoonTestUse1
2024-12-23 22:53:05 +06:00
parent b898fd915d
commit 21c61ce8da
42 changed files with 13 additions and 16 deletions

View File

@@ -0,0 +1,31 @@
import { ref } from 'vue';
export function useNotification() {
const show = ref(false);
const message = ref('');
const type = ref<'success' | 'error'>('success');
function showNotification(newMessage: string, newType: 'success' | 'error' = 'success', duration = 3000) {
message.value = newMessage;
type.value = newType;
show.value = true;
if (duration > 0) {
setTimeout(() => {
show.value = false;
}, duration);
}
}
function hideNotification() {
show.value = false;
}
return {
show,
message,
type,
showNotification,
hideNotification
};
}