Improve service worker store managment

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
Gregoire Parant 2021-08-11 10:01:56 +02:00
parent bced495570
commit 434b112c65
3 changed files with 4 additions and 13 deletions

View File

@ -1,4 +1,4 @@
let CACHE_NAME = 'workavdenture-cache-v1'; let CACHE_NAME = 'workavdenture-cache-dev';
let urlsToCache = [ let urlsToCache = [
'/' '/'
]; ];
@ -14,16 +14,7 @@ self.addEventListener('install', function(event) {
}); });
self.addEventListener('fetch', (event) => { self.addEventListener('fetch', (event) => {
event.respondWith( //never cache data will be stored in dev mode
caches.match(event.request)
.then((response) => {
return fetch(event.request).then((response) => {
//Dev service worker, just return reponse
return response;
}
);
})
);
}); });
self.addEventListener('wait', function(event) { self.addEventListener('wait', function(event) {

View File

@ -1,4 +1,4 @@
let CACHE_NAME = 'workavdenture-cache-v1'; let CACHE_NAME = 'workavdenture-cache-v1.2';
let urlsToCache = [ let urlsToCache = [
'/' '/'
]; ];

View File

@ -201,7 +201,7 @@ module.exports = {
MAX_USERNAME_LENGTH: 8, MAX_USERNAME_LENGTH: 8,
MAX_PER_GROUP: 4, MAX_PER_GROUP: 4,
DISPLAY_TERMS_OF_USE: false, DISPLAY_TERMS_OF_USE: false,
NODE_ENV: "development", NODE_ENV: mode,
}), }),
], ],
} as Configuration & WebpackDevServer.Configuration; } as Configuration & WebpackDevServer.Configuration;