1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

notifications: notification settings page

This commit is contained in:
Fedor Katurov 2023-03-16 11:00:29 +06:00
parent d77a01d8bc
commit 7135d06673
17 changed files with 319 additions and 35 deletions

View file

@ -0,0 +1,28 @@
import { ApiGetNotificationSettingsResponse } from '~/api/notifications/types';
import { NotificationSettings } from '~/types/notifications';
import { ApiUpdateNotificationSettingsRequest } from '../../api/notifications/types';
export const notificationSettingsFromRequest = (
req: ApiGetNotificationSettingsResponse,
): NotificationSettings => ({
enabled: req.enabled,
flow: req.flow,
comments: req.comments,
sendTelegram: req.send_telegram,
showIndicator: req.show_indicator,
lastDate: req.last_date ?? null,
lastSeen: req.last_seen ?? null,
});
export const notificationSettingsToRequest = (
req: Partial<NotificationSettings>,
): ApiUpdateNotificationSettingsRequest => ({
enabled: req.enabled,
flow: req.flow,
comments: req.comments,
send_telegram: req.sendTelegram,
show_indicator: req.showIndicator,
last_date: req.lastDate,
last_seen: req.lastSeen,
});