1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

notifications: updating lastSeen when list is opened

This commit is contained in:
Fedor Katurov 2023-03-11 19:30:18 +06:00
parent a39d000ff2
commit 97590d88af
7 changed files with 88 additions and 4 deletions

View file

@ -4,6 +4,8 @@ import { api, cleanResult } from '~/utils/api';
import {
ApiGetNotificationSettingsResponse,
ApiGetNotificationsResponse,
ApiUpdateNotificationSettingsResponse,
ApiUpdateNotificationSettingsRequest,
} from './types';
export const apiGetNotificationSettings = () =>
@ -15,3 +17,13 @@ export const apiGetNotifications = () =>
api
.get<ApiGetNotificationsResponse>(API.NOTIFICATIONS.LIST)
.then(cleanResult);
export const apiUpdateNotificationSettings = (
settings: ApiUpdateNotificationSettingsRequest,
) =>
api
.post<ApiUpdateNotificationSettingsResponse>(
API.NOTIFICATIONS.SETTINGS,
settings,
)
.then(cleanResult);

View file

@ -7,7 +7,11 @@ export interface ApiGetNotificationSettingsResponse {
last_seen?: string | null;
last_date?: string | null;
}
export type ApiUpdateNotificationSettingsResponse =
ApiGetNotificationSettingsResponse;
export type ApiUpdateNotificationSettingsRequest =
Partial<ApiGetNotificationSettingsResponse>;
export interface ApiGetNotificationsResponse {
items?: NotificationItem[];
}