add isloading
gitea/salix-front/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pau 2023-01-25 08:27:45 +01:00
parent 9e0adce4f1
commit 88e8530b43
1 changed files with 6 additions and 3 deletions

View File

@ -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();
}
</script>
<template>
@ -269,7 +272,7 @@ async function toggleNotif(notif, chip) {
</q-item-section>
<q-item-section side top>
<q-toggle
:disable="!notif.allowed"
:disable="!notif.allowed || isLoading"
checked-icon="check"
unchecked-icon="close"
indeterminate-icon="block"