fix: undefined on strings

This commit is contained in:
Jean-Baptiste Pasquier 2021-04-08 21:25:14 +02:00
parent 82e5b82572
commit ba25ac93a5

View File

@ -10,31 +10,33 @@ if ('serviceWorker' in navigator) {
let registration;
const showSkipWaitingPrompt = (event) => {
Swal.fire({
position: 'bottom-end',
backdrop: false,
title: "",
text: hubl.intl.t('serviceWorker.newUpdate') + ". " + hubl.intl.t('serviceWorker.wantToUpdate'),
imageUrl: hubl.client.logo || 'https://cdn.startinblox.com/logos/webp/hubl.webp',
imageAlt: hubl.client.name,
showCancelButton: true,
confirmButtonClass: 'button text-xsmall text-bold text-center reversed color-secondary bordered icon icon-check no-background-image',
cancelButtonClass: 'button text-xsmall text-bold text-center reversed color-primary bordered icon icon-exclamation no-background-image',
confirmButtonText: hubl.intl.t('serviceWorker.yes'),
cancelButtonText: hubl.intl.t('serviceWorker.no')
}).then((result) => {
if (result.isConfirmed) {
wb.addEventListener('controlling', (event) => {
window.location.reload();
});
if (registration && registration.waiting) {
messageSW(registration.waiting, {
type: 'SKIP_WAITING'
if(hubl.intl.t('serviceWorker.newUpdate') != undefined) {
Swal.fire({
position: 'bottom-end',
backdrop: false,
title: "",
text: hubl.intl.t('serviceWorker.newUpdate') + ". " + hubl.intl.t('serviceWorker.wantToUpdate'),
imageUrl: hubl.client.logo || 'https://cdn.startinblox.com/logos/webp/hubl.webp',
imageAlt: hubl.client.name,
showCancelButton: true,
confirmButtonClass: 'button text-xsmall text-bold text-center reversed color-secondary bordered icon icon-check no-background-image',
cancelButtonClass: 'button text-xsmall text-bold text-center reversed color-primary bordered icon icon-exclamation no-background-image',
confirmButtonText: hubl.intl.t('serviceWorker.yes'),
cancelButtonText: hubl.intl.t('serviceWorker.no')
}).then((result) => {
if (result.isConfirmed) {
wb.addEventListener('controlling', (event) => {
window.location.reload();
});
if (registration && registration.waiting) {
messageSW(registration.waiting, {
type: 'SKIP_WAITING'
});
}
}
}
});
});
}
};
wb.addEventListener('waiting', showSkipWaitingPrompt);