Adding alerted scene to stashes.

This commit is contained in:
DebaucheryLibrarian
2021-04-29 01:45:01 +02:00
parent 4806b0aa41
commit 3f55b90ab8
8 changed files with 77 additions and 46 deletions

View File

@@ -34,7 +34,7 @@ function initUiActions(store, _router) {
return [];
}
const { notifications } = await graphql(`
const { notifications, unseenNotifications } = await graphql(`
query Notifications(
$hasAuth: Boolean!
$userId: Int
@@ -76,6 +76,11 @@ function initUiActions(store, _router) {
}
}
}
unseenNotifications: notificationsConnection(
filter: { seen: { equalTo: false } }
) {
totalCount
}
}
`, {
hasAuth: !!store.state.auth.user,
@@ -85,7 +90,12 @@ function initUiActions(store, _router) {
const curatedNotifications = notifications.map(notification => curateNotification(notification));
commit('setNotifications', curatedNotifications);
return curatedNotifications;
commit('setUnseenNotificationsCount', unseenNotifications.totalCount);
return {
notifications: curatedNotifications,
unseenCount: unseenNotifications.totalCount,
};
}
async function checkNotification(context, notificationId) {
@@ -198,8 +208,8 @@ function initUiActions(store, _router) {
});
return {
releases: res.results.map(result => curateRelease(result.release)),
actors: res.actors.map(actor => curateActor(actor)),
releases: res?.results.map(result => curateRelease(result.release)) || [],
actors: res?.actors.map(actor => curateActor(actor)) || [],
};
}

View File

@@ -2,6 +2,10 @@ function setNotifications(state, notifications) {
state.notifications = notifications;
}
function setUnseenNotificationsCount(state, count) {
state.unseenNotificationsCount = count;
}
function setTagFilter(state, tagFilter) {
state.tagFilter = tagFilter;
}
@@ -24,6 +28,7 @@ function setTheme(state, theme) {
export default {
setNotifications,
setUnseenNotificationsCount,
setTagFilter,
setRange,
setBatch,

View File

@@ -12,4 +12,5 @@ export default {
sfw: storedSfw === 'true' || false,
theme: storedTheme || deviceTheme,
notifications: [],
unseenNotificationsCount: 0,
};