Main functions
This commit is contained in:
11
public/sw.js
11
public/sw.js
@@ -1,7 +1,7 @@
|
||||
// Service Worker for SmartSolTech PWA
|
||||
const CACHE_NAME = 'smartsoltech-v1.0.1';
|
||||
const STATIC_CACHE_NAME = 'smartsoltech-static-v1.0.1';
|
||||
const DYNAMIC_CACHE_NAME = 'smartsoltech-dynamic-v1.0.1';
|
||||
const CACHE_NAME = 'smartsoltech-v1.0.2';
|
||||
const STATIC_CACHE_NAME = 'smartsoltech-static-v1.0.2';
|
||||
const DYNAMIC_CACHE_NAME = 'smartsoltech-dynamic-v1.0.2';
|
||||
|
||||
// Files to cache immediately
|
||||
const STATIC_FILES = [
|
||||
@@ -101,8 +101,9 @@ self.addEventListener('fetch', event => {
|
||||
event.respondWith(cacheFirst(request));
|
||||
} else if (isAPIRequest(request.url)) {
|
||||
event.respondWith(networkFirst(request));
|
||||
} else if (isDynamicRoute(request.url)) {
|
||||
event.respondWith(staleWhileRevalidate(request));
|
||||
} else if (isDynamicRoute(request.url) || url.pathname === '/') {
|
||||
// For main pages, always check network first to ensure language consistency
|
||||
event.respondWith(networkFirst(request));
|
||||
} else {
|
||||
event.respondWith(networkFirst(request));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user