Added notification clear, improved notification styling.

This commit is contained in:
DebaucheryLibrarian
2021-04-25 03:08:50 +02:00
parent f8a3bf6a64
commit fc1c2fc2f3
8 changed files with 265 additions and 77 deletions

View File

@@ -1,4 +1,4 @@
import { graphql } from '../api';
import { graphql, patch } from '../api';
import { releaseFields, actorStashesFields } from '../fragments';
import { curateRelease, curateActor, curateNotification } from '../curate';
@@ -39,10 +39,13 @@ function initUiActions(store, _router) {
$hasAuth: Boolean!
$userId: Int
) {
notifications {
notifications(
first: 10
) {
id
sceneId
userId
seen
createdAt
scene {
${releaseFields}
@@ -76,6 +79,18 @@ function initUiActions(store, _router) {
return curatedNotifications;
}
async function checkNotification(context, notificationId) {
await patch(`/users/${store.state.auth.user?.id}/notifications/${notificationId}`, {
seen: true,
});
}
async function checkNotifications() {
await patch(`/users/${store.state.auth.user?.id}/notifications`, {
seen: true,
});
}
async function search({ _commit }, { query, limit = 20 }) {
const res = await graphql(`
query SearchReleases(
@@ -217,6 +232,8 @@ function initUiActions(store, _router) {
}
return {
checkNotification,
checkNotifications,
search,
setTagFilter,
setRange,