From f78518930422ead5feb7a2881ed3b3f4c3d9491b Mon Sep 17 00:00:00 2001 From: jedi Date: Sat, 13 Jul 2024 17:28:38 +0200 Subject: [PATCH] stash --- web/src/components/Timeline.vue | 2 +- web/src/store.js | 8 +++++- web/src/views/admin/Notifications.vue | 37 +++++++++++++++++++++++---- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/web/src/components/Timeline.vue b/web/src/components/Timeline.vue index f3ac1d8..88bfa94 100644 --- a/web/src/components/Timeline.vue +++ b/web/src/components/Timeline.vue @@ -73,7 +73,7 @@ import TimelineMail from "@/components/TimelineMail.vue"; import TimelineComment from "@/components/TimelineComment.vue"; import TimelineStateChange from "@/components/TimelineStateChange.vue"; -import {mapGetters} from "vuex"; +import {mapActions, mapGetters} from "vuex"; import TimelineAssignment from "@/components/TimelineAssignment.vue"; import TimelineRelatedItem from "@/components/TimelineRelatedItem.vue"; import TimelineShippingVoucher from "@/components/TimelineShippingVoucher.vue"; diff --git a/web/src/store.js b/web/src/store.js index c7c37a5..9ab6504 100644 --- a/web/src/store.js +++ b/web/src/store.js @@ -48,6 +48,7 @@ const store = createStore({ states: 0, messageTemplates: 0, shippingVouchers: 0, + userNotificationChannels: 0, }, persistent_loaded: false, shared_loaded: false, @@ -262,6 +263,10 @@ const store = createStore({ state.shippingVouchers = codes; state.fetchedData = {...state.fetchedData, shippingVouchers: Date.now()}; }, + setUserNotificationChannels(state, channels) { + state.userNotificationChannels = channels; + state.fetchedData = {...state.fetchedData, userNotificationChannels: Date.now()}; + }, }, actions: { async login({commit}, {username, password, remember}) { @@ -544,9 +549,10 @@ const store = createStore({ }, async fetchUserNotificationChannels({commit, state}) { if (!state.user.token) return; + if (state.fetchedData.userNotificationChannels > Date.now() - 1000 * 60 * 60 * 24) return; const {data, success} = await http.get('/2/user_notification_channels/', state.user.token); if (data && success) { - state.userNotificationChannels = data; + commit('setUserNotificationChannels', data); } }, }, diff --git a/web/src/views/admin/Notifications.vue b/web/src/views/admin/Notifications.vue index 312a902..71cb630 100644 --- a/web/src/views/admin/Notifications.vue +++ b/web/src/views/admin/Notifications.vue @@ -1,9 +1,36 @@