♻️(service-worker) admin NetworkOnly

We will use the NetworkOnly strategy
for the admin part.
This commit is contained in:
Anthony LC
2024-07-02 23:46:29 +02:00
committed by Anthony LC
parent edffbbaf99
commit 2e0b6b2a2a

View File

@@ -14,6 +14,7 @@ import {
CacheFirst,
NetworkFirst,
NetworkFirstOptions,
NetworkOnly,
StrategyOptions,
} from 'workbox-strategies';
@@ -147,6 +148,15 @@ registerRoute(
'GET',
);
/**
* Admin cache strategy
*/
registerRoute(
({ url }) =>
url.href.includes(self.location.origin) && url.href.includes('/admin/'),
new NetworkOnly(),
);
/**
* Cache stategy static files images (images / svg)
*/