feature notifications

This commit is contained in:
Alexandro Uc Santos
2024-09-07 18:44:57 -06:00
parent 84c0595f5b
commit c5f0831a81
23 changed files with 514 additions and 96 deletions

View File

@@ -16,6 +16,7 @@ export const useAuthStore = defineStore('auth', () => {
const company = useCompanyStore();
const loadStore = useLoadsStore();
const vehiclesStore = useVehiclesStore();
const notyStore = useNotificationsStore();
const sesion = ref('')
const checking = ref(false);
const authStatus = ref('checking');
@@ -89,6 +90,11 @@ export const useAuthStore = defineStore('auth', () => {
user.value = null;
checking.value = false;
authStatus.value = 'checking'
notyStore.notifications = [];
notyStore.newNoty = false;
notyStore.show = false;
notyStore.openNotifications = false;
notyStore.toggleProfile = false;
company.clear();
loadStore.clear();

View File

@@ -8,6 +8,9 @@ export const useNotificationsStore = defineStore('notifications', () => {
const error = ref(false)
const show = ref(false);
const openProfile = ref(false);
const openNotifications = ref(false);
const notifications = ref([]);
const newNoty = ref(false);
watch(show, () => {
if(show) {
@@ -23,12 +26,25 @@ export const useNotificationsStore = defineStore('notifications', () => {
openProfile.value = !openProfile.value;
}
const toggleNotifications = () => {
openNotifications.value = !openNotifications.value;
}
const removeNoty = (id) => {
return notifications.value = notifications.value.filter(noty => noty._id !== id);
}
return {
text,
error,
show,
notifications,
newNoty,
openProfile,
removeNoty,
toggleProfile,
openNotifications,
toggleNotifications
}
});