Fetch notification count only when logged in
This commit is contained in:
parent
a69ac8a17b
commit
9d8465c950
|
@ -1,4 +1,4 @@
|
||||||
FROM gitpod/workspace-full:2022-07-17-14-41-27
|
FROM gitpod/workspace-full:2022-07-12-11-05-29
|
||||||
USER gitpod
|
USER gitpod
|
||||||
|
|
||||||
RUN sudo apt update -y \
|
RUN sudo apt update -y \
|
||||||
|
|
|
@ -95,26 +95,28 @@ const moderationNotifications = computed(() =>
|
||||||
)
|
)
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const [edits, reports, requests] = await Promise.all([
|
if (store.state.auth.authenticated) {
|
||||||
axios.get('mutations/', { params: { page_size: 1, q: 'is_approved:null' } }).catch(() => ({ data: { count: 0 } })),
|
const [edits, reports, requests] = await Promise.all([
|
||||||
axios.get('manage/moderation/reports/', { params: { page_size: 1, q: 'resolved:no' } }).catch(() => ({ data: { count: 0 } })),
|
axios.get('mutations/', { params: { page_size: 1, q: 'is_approved:null' } }).catch(() => ({ data: { count: 0 } })),
|
||||||
axios.get('manage/moderation/requests/', { params: { page_size: 1, q: 'status:pending' } }).catch(() => ({ data: { count: 0 } }))
|
axios.get('manage/moderation/reports/', { params: { page_size: 1, q: 'resolved:no' } }).catch(() => ({ data: { count: 0 } })),
|
||||||
])
|
axios.get('manage/moderation/requests/', { params: { page_size: 1, q: 'status:pending' } }).catch(() => ({ data: { count: 0 } }))
|
||||||
|
])
|
||||||
|
|
||||||
store.commit('ui/incrementNotifications', {
|
store.commit('ui/incrementNotifications', {
|
||||||
type: 'pendingReviewEdits',
|
type: 'pendingReviewEdits',
|
||||||
value: edits.data.count
|
value: edits.data.count
|
||||||
})
|
})
|
||||||
|
|
||||||
store.commit('ui/incrementNotifications', {
|
store.commit('ui/incrementNotifications', {
|
||||||
type: 'pendingReviewRequests',
|
type: 'pendingReviewRequests',
|
||||||
value: requests.data.count
|
value: requests.data.count
|
||||||
})
|
})
|
||||||
|
|
||||||
store.commit('ui/incrementNotifications', {
|
store.commit('ui/incrementNotifications', {
|
||||||
type: 'pendingReviewReports',
|
type: 'pendingReviewReports',
|
||||||
value: reports.data.count
|
value: reports.data.count
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const isProduction = import.meta.env.PROD
|
const isProduction = import.meta.env.PROD
|
||||||
|
|
Loading…
Reference in New Issue