From 88e8530b434d867ff7b0a606d7575f5f665180c3 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Wed, 25 Jan 2023 08:27:45 +0100 Subject: [PATCH] add isloading --- src/pages/Worker/Card/WorkerNotificationsManager.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/Worker/Card/WorkerNotificationsManager.vue b/src/pages/Worker/Card/WorkerNotificationsManager.vue index ef63ec434..37a0bb5c6 100644 --- a/src/pages/Worker/Card/WorkerNotificationsManager.vue +++ b/src/pages/Worker/Card/WorkerNotificationsManager.vue @@ -50,8 +50,10 @@ const workerFilter = { }; const notificationAcls = ref([]); +const isLoading = ref(false); async function fetch() { + isLoading.value = true; const { data } = await axios.get(`Workers/${entityId.value}`, { params: { filter: JSON.stringify(workerFilter), @@ -168,6 +170,7 @@ async function fetch() { } worker.value = data; + isLoading.value = false; } function sortNotifs() { @@ -193,7 +196,7 @@ async function toggleNotif(notif, chip) { notif.active = !notif.active; } if (notif.active) { - let notificationSubscription = await axios.post( + await axios.post( `NotificationSubscriptions`, { notificationFk: notif.id, @@ -205,7 +208,6 @@ async function toggleNotif(notif, chip) { }, } ); - worker.value.subscribedNotifs.push(notificationSubscription.data); quasar.notify({ type: 'positive', message: t('worker.notificationsManager.subscribed'), @@ -227,6 +229,7 @@ async function toggleNotif(notif, chip) { message: t('worker.notificationsManager.unsubscribed'), }); } + await fetch(); }