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 = [
'/'
];
@ -14,16 +14,7 @@ self.addEventListener('install', function(event) {
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request)
.then((response) => {
return fetch(event.request).then((response) => {
//Dev service worker, just return reponse
return response;
}
);
})
);
//never cache data will be stored in dev mode
});
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 = [
'/'
];

View File

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