re-enable sw

This commit is contained in:
Jean-Baptiste Pasquier 2020-10-28 12:27:10 +01:00
parent 0c4c358175
commit f8763b28a4
1 changed files with 21 additions and 13 deletions

View File

@ -5,6 +5,7 @@ self.addEventListener('install', function (e) {
'/components/hubl-reactivity.js',
'/components/hubl-search-users.js',
'/components/hubl-status.js',
'/components/sentry.js',
'/fonts/custom-icons.eot',
'/fonts/custom-icons.svg',
'/fonts/custom-icons.ttf',
@ -33,16 +34,23 @@ self.addEventListener('install', function (e) {
'/fonts/simple-line-icons.woff2',
'/images/add-user.svg',
'/images/alien.svg',
'/images/appointment.svg',
'/images/arrow-down.svg',
'/images/calendar.svg',
'/images/chevron-down.png',
'/images/favicon.png',
'/images/file.svg',
'/images/hubl-icon-192.png',
'/images/hubl-icon-512.png',
'/images/logo.png',
'/images/send.png',
'/images/vote.svg',
'/locales/es.json',
'/locales/fr.json',
'/scripts/index.js',
'/syles/index.css',
'/index.html',
'/manifest.webmanifest',
'/'
]);
})
@ -50,17 +58,17 @@ self.addEventListener('install', function (e) {
});
//TODO: Can't use fetch because of unpkg, e.request is missing a part of the package name "@startinblox/core" become "@startinblox"
// self.addEventListener('fetch', function (e) {
self.addEventListener('fetch', function (e) {
// Handle direct loading /xyz/ when server is unjoinable
// if (e.request.mode === 'navigate') {
// e.respondWith(caches.match('/'));
// return;
// }
// e.respondWith(
// fetch(e.request, {
// credentials: 'include'
// }).catch(function() {
// return caches.match(e.request);
// })
// );
// });
if (e.request.mode === 'navigate') {
e.respondWith(caches.match('/'));
return;
}
e.respondWith(
fetch(e.request, {
credentials: 'include'
}).catch(function() {
return caches.match(e.request);
})
);
});