From f8763b28a4fdb9de37880e804ce17ec3e11e94dd Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Wed, 28 Oct 2020 12:27:10 +0100 Subject: [PATCH] re-enable sw --- src/sw.js | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/sw.js b/src/sw.js index f8ca55f..200384b 100644 --- a/src/sw.js +++ b/src/sw.js @@ -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); - // }) - // ); -// }); \ No newline at end of file + if (e.request.mode === 'navigate') { + e.respondWith(caches.match('/')); + return; + } + e.respondWith( + fetch(e.request, { + credentials: 'include' + }).catch(function() { + return caches.match(e.request); + }) + ); +}); \ No newline at end of file