Skip to content

Commit 99691cd

Browse files
committed
Factor out vapid key
1 parent 47cef35 commit 99691cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

web/lib/service/notifications.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {urlBase64ToUint8Array} from "common/util/parse";
33
import {api} from "web/lib/api";
44
import {useUser} from "web/hooks/use-user";
55

6+
const vapidPublicKey = 'BF80q7LrDa4a5ksS2BZrX6PPvL__y0jCNvNqyUzvk8Y4ofTdrS0kRnKfGpClCQAHWmcPHIUmWq8jgQ4ROquSpJQ'
7+
68
export default function PushSubscriber() {
79
const user = useUser(); // authenticated user
810

@@ -32,7 +34,7 @@ export default function PushSubscriber() {
3234

3335
const subscription = await registration.pushManager.subscribe({
3436
userVisibleOnly: true,
35-
applicationServerKey: urlBase64ToUint8Array('BF80q7LrDa4a5ksS2BZrX6PPvL__y0jCNvNqyUzvk8Y4ofTdrS0kRnKfGpClCQAHWmcPHIUmWq8jgQ4ROquSpJQ'),
37+
applicationServerKey: urlBase64ToUint8Array(vapidPublicKey),
3638
});
3739

3840
// Send subscription to server

0 commit comments

Comments
 (0)