Minor fixes & improvements
- Move push subscription handling to Notifier class - Allow duplicate options in config - Only save subscription in frontend if sub call was successful
This commit is contained in:
		@ -250,7 +250,6 @@ function initPush(name) {
 | 
			
		||||
			applicationServerKey: pushServerPublicKey
 | 
			
		||||
		}).then(function(subscription) {
 | 
			
		||||
			console.log("User is subscribed:", subscription);
 | 
			
		||||
			localStorage.setItem('pushsub', subscription);
 | 
			
		||||
 | 
			
		||||
			fetch('/pushsubscribe', {
 | 
			
		||||
				method: "POST",
 | 
			
		||||
@ -259,6 +258,9 @@ function initPush(name) {
 | 
			
		||||
					name: name,
 | 
			
		||||
					sub: subscription
 | 
			
		||||
				})
 | 
			
		||||
			}).then(function(res) {
 | 
			
		||||
				if (res.ok)
 | 
			
		||||
					localStorage.setItem('pushsub', subscription);
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user