fix missing config file handling for notifications
This commit is contained in:
parent
baf0c2e887
commit
21f1eda1f5
@ -127,6 +127,8 @@ $config_data = json_decode($raw_json_config, false);
|
|||||||
return response.text().then((text) => {
|
return response.text().then((text) => {
|
||||||
config_data = JSON.parse(text);
|
config_data = JSON.parse(text);
|
||||||
});
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
config_data = Object(); // leave empty
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +144,7 @@ $config_data = json_decode($raw_json_config, false);
|
|||||||
if (Notification.permission == 'granted') {
|
if (Notification.permission == 'granted') {
|
||||||
navigator.serviceWorker.getRegistration().then(function(reg) {
|
navigator.serviceWorker.getRegistration().then(function(reg) {
|
||||||
reg.showNotification("Neues Wort auf " + (config_data.title ? config_data.title : "OWE"),
|
reg.showNotification("Neues Wort auf " + (config_data.title ? config_data.title : "OWE"),
|
||||||
{ body: word, icon: config_data.logo.image_path ? config_data.logo.image_path : "OWE_Logo.png", requireInteraction: true });
|
{ body: word, icon: (config_data.logo? config_data.logo.image_path : "OWE_Logo.png"), requireInteraction: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user