summaryrefslogtreecommitdiff
path: root/src/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/app')
-rw-r--r--src/web/app/common/mios.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts
index 7f9aacc46c..e73a65bff8 100644
--- a/src/web/app/common/mios.ts
+++ b/src/web/app/common/mios.ts
@@ -257,8 +257,14 @@ export default class MiOS extends EventEmitter {
});
}).then(() => {
this.logInfo('[sw] Server Stored Subscription.');
- }).catch(err => {
+ }).catch(async (err) => {
this.logError('[sw] Subscribe Error:', err);
+
+ // 違うapplicationServerKey (または gcm_sender_id)のサブスクリプションが
+ // 既に存在していることが原因でエラーになった可能性があるので、
+ // そのサブスクリプションを解除しておく
+ const subscription = await this.swRegistration.pushManager.getSubscription();
+ if (subscription) subscription.unsubscribe();
});
});