summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkPushNotificationAllowButton.vue
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/components/MkPushNotificationAllowButton.vue')
-rw-r--r--packages/frontend/src/components/MkPushNotificationAllowButton.vue38
1 files changed, 19 insertions, 19 deletions
diff --git a/packages/frontend/src/components/MkPushNotificationAllowButton.vue b/packages/frontend/src/components/MkPushNotificationAllowButton.vue
index b98c814f24..448084d9ba 100644
--- a/packages/frontend/src/components/MkPushNotificationAllowButton.vue
+++ b/packages/frontend/src/components/MkPushNotificationAllowButton.vue
@@ -72,28 +72,28 @@ function subscribe() {
userVisibleOnly: true,
applicationServerKey: urlBase64ToUint8Array(instance.swPublickey),
})
- .then(async subscription => {
- pushSubscription = subscription;
+ .then(async subscription => {
+ pushSubscription = subscription;
- // Register
- pushRegistrationInServer = await api('sw/register', {
- endpoint: subscription.endpoint,
- auth: encode(subscription.getKey('auth')),
- publickey: encode(subscription.getKey('p256dh')),
- });
- }, async err => { // When subscribe failed
+ // Register
+ pushRegistrationInServer = await api('sw/register', {
+ endpoint: subscription.endpoint,
+ auth: encode(subscription.getKey('auth')),
+ publickey: encode(subscription.getKey('p256dh')),
+ });
+ }, async err => { // When subscribe failed
// 通知が許可されていなかったとき
- if (err?.name === 'NotAllowedError') {
- console.info('User denied the notification permission request.');
- return;
- }
+ if (err?.name === 'NotAllowedError') {
+ console.info('User denied the notification permission request.');
+ return;
+ }
- // 違うapplicationServerKey (または gcm_sender_id)のサブスクリプションが
- // 既に存在していることが原因でエラーになった可能性があるので、
- // そのサブスクリプションを解除しておく
- // (これは実行されなさそうだけど、おまじない的に古い実装から残してある)
- await unsubscribe();
- }), null, null);
+ // 違うapplicationServerKey (または gcm_sender_id)のサブスクリプションが
+ // 既に存在していることが原因でエラーになった可能性があるので、
+ // そのサブスクリプションを解除しておく
+ // (これは実行されなさそうだけど、おまじない的に古い実装から残してある)
+ await unsubscribe();
+ }), null, null);
}
async function unsubscribe() {