diff --git a/src/pages/Worker/Card/WorkerNotificationsManager.vue b/src/pages/Worker/Card/WorkerNotificationsManager.vue index 5877ae411..2b6ec3340 100644 --- a/src/pages/Worker/Card/WorkerNotificationsManager.vue +++ b/src/pages/Worker/Card/WorkerNotificationsManager.vue @@ -3,7 +3,6 @@ import { onMounted, computed, ref, onUpdated } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { useQuasar } from 'quasar'; -import { useState } from 'src/composables/useState'; import { useSession } from 'src/composables/useSession'; import axios from 'axios'; @@ -22,7 +21,6 @@ const route = useRoute(); const { t } = useI18n(); const { getToken } = useSession(); const quasar = useQuasar(); -const state = useState(); const entityId = computed(() => { return $props.id || route.params.id; @@ -52,7 +50,6 @@ const workerFilter = { }; const notificationAcls = ref([]); -const allowedEditing = ref(false); async function fetch() { const { data } = await axios.get(`Workers/${entityId.value}`, { @@ -170,10 +167,6 @@ async function fetch() { console.log(e); } - if (state.getUser().value.id == data.user.id) { - allowedEditing.value = true; - } - worker.value = data; } @@ -217,13 +210,24 @@ async function toggleNotif(notif, chip) { message: t('worker.notificationsManager.subscribed'), }); } else { - await axios.post(`NotificationSubscriptions/deleteSubscription`, { - notificationId: notif.id + '', - userId: entityId.value, - headers: { - Authorization: getToken(), + const token = await getToken(); + + const tokenUser = await axios.get(`AccessTokens/${token}/user`); + console.log(tokenUser); + + await axios.post( + `NotificationSubscriptions/deleteNotification`, + { + userId: entityId.value, + notificationId: notif.id, + authorId: tokenUser.data.id, }, - }); + { + headers: { + Authorization: getToken(), + }, + } + ); quasar.notify({ type: 'positive', message: t('worker.notificationsManager.unsubscribed'), @@ -243,7 +247,6 @@ async function toggleNotif(notif, chip) {