Fix bug
This commit is contained in:
		
							parent
							
								
									b44c7e9ae0
								
							
						
					
					
						commit
						5639b78c62
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -257,8 +257,14 @@ export default class MiOS extends EventEmitter {
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			}).then(() => {
 | 
								}).then(() => {
 | 
				
			||||||
				this.logInfo('[sw] Server Stored Subscription.');
 | 
									this.logInfo('[sw] Server Stored Subscription.');
 | 
				
			||||||
			}).catch(err => {
 | 
								}).catch(async (err) => {
 | 
				
			||||||
				this.logError('[sw] Subscribe Error:', err);
 | 
									this.logError('[sw] Subscribe Error:', err);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// 違うapplicationServerKey (または gcm_sender_id)のサブスクリプションが
 | 
				
			||||||
 | 
									// 既に存在していることが原因でエラーになった可能性があるので、
 | 
				
			||||||
 | 
									// そのサブスクリプションを解除しておく
 | 
				
			||||||
 | 
									const subscription = await this.swRegistration.pushManager.getSubscription();
 | 
				
			||||||
 | 
									if (subscription) subscription.unsubscribe();
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue