From e649be58a2db630924069be27747d5d54fb2b71d Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 5 Jun 2024 18:42:39 +0800 Subject: [PATCH] add webpush switch --- src/api/types.ts | 1 + src/pages/login.vue | 6 +++++- src/views/setting/AccountSettingNotification.vue | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/api/types.ts b/src/api/types.ts index b7c11ce9..79d9de50 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -720,6 +720,7 @@ export interface NotificationSwitch { slack: boolean synologychat: boolean vocechat: boolean + webpush: boolean } // 文件浏览接口 diff --git a/src/pages/login.vue b/src/pages/login.vue index 8257e49d..eaf92720 100644 --- a/src/pages/login.vue +++ b/src/pages/login.vue @@ -107,7 +107,11 @@ async function subscribeForPushNotifications() { } }) // 发送订阅请求 - await api.post('/message/subscribe', subscription) + try { + await api.post('/message/webpush/subscribe', subscription) + } catch (e) { + console.log(e) + } } } diff --git a/src/views/setting/AccountSettingNotification.vue b/src/views/setting/AccountSettingNotification.vue index bc78375c..d6b4f5b4 100644 --- a/src/views/setting/AccountSettingNotification.vue +++ b/src/views/setting/AccountSettingNotification.vue @@ -56,6 +56,10 @@ const NotificationChannels = [ title: 'VoceChat', value: 'vocechat', }, + { + title: 'WebPush', + value: 'webpush', + }, ] // 提示框 @@ -430,6 +434,7 @@ onMounted(() => { Slack SynologyChat VoceChat + WebPush @@ -452,6 +457,9 @@ onMounted(() => { + + + 没有设置任何通知渠道