fix
This commit is contained in:
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
# email-bill
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
[VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
||||
|
||||
## Recommended Browser Setup
|
||||
|
||||
- Chromium-based browsers (Chrome, Edge, Brave, etc.):
|
||||
- [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
|
||||
- [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters)
|
||||
- Firefox:
|
||||
- [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
|
||||
- [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
|
||||
|
||||
## Customize configuration
|
||||
|
||||
See [Vite Configuration Reference](https://vite.dev/config/).
|
||||
|
||||
## Project Setup
|
||||
|
||||
```sh
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### Compile and Hot-Reload for Development
|
||||
|
||||
```sh
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
### Compile and Minify for Production
|
||||
|
||||
```sh
|
||||
pnpm build
|
||||
```
|
||||
|
||||
### Lint with [ESLint](https://eslint.org/)
|
||||
|
||||
```sh
|
||||
pnpm lint
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "email-bill",
|
||||
"version": "0.0.0",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"short_name": "账单",
|
||||
"description": "个人账单管理与邮件解析",
|
||||
"start_url": "/",
|
||||
"display": "minimal-ui",
|
||||
"display": "standalone",
|
||||
"background_color": "#ffffff",
|
||||
"theme_color": "#1989fa",
|
||||
"orientation": "portrait-primary",
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
export function getVapidPublicKey() {
|
||||
return request({
|
||||
url: '/notification/vapid-public-key',
|
||||
url: '/Notification/GetVapidPublicKey',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function subscribe(data) {
|
||||
return request({
|
||||
url: '/notification/subscribe',
|
||||
url: '/Notification/Subscribe',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@@ -17,7 +17,7 @@ export function subscribe(data) {
|
||||
|
||||
export function testNotification(message) {
|
||||
return request({
|
||||
url: '/notification/test',
|
||||
url: '/Notification/TestNotification',
|
||||
method: 'post',
|
||||
params: { message }
|
||||
})
|
||||
|
||||
@@ -107,8 +107,13 @@ const handleNotificationToggle = async (checked) => {
|
||||
return
|
||||
}
|
||||
|
||||
const { data: { publicKey } } = await getVapidPublicKey()
|
||||
const convertedVapidKey = urlBase64ToUint8Array(publicKey)
|
||||
let { success, data, message } = await getVapidPublicKey()
|
||||
|
||||
if (!success) {
|
||||
throw new Error(message || '获取 VAPID 公钥失败')
|
||||
}
|
||||
|
||||
const convertedVapidKey = urlBase64ToUint8Array(data)
|
||||
|
||||
const subscription = await registration.pushManager.subscribe({
|
||||
userVisibleOnly: true,
|
||||
|
||||
Reference in New Issue
Block a user