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 cb08834..87b13a5 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}) { @@ -551,9 +556,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 @@