feature notifications
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user