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:
parent
d77a01d8bc
commit
7135d06673
17 changed files with 319 additions and 35 deletions
28
src/utils/notifications/notificationSettingsFromRequest.ts
Normal file
28
src/utils/notifications/notificationSettingsFromRequest.ts
Normal 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,
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue