Skip to content

Commit

Permalink
♻️(service-worker) admin NetworkOnly
Browse files Browse the repository at this point in the history
We will use the NetworkOnly strategy
for the admin part.
  • Loading branch information
AntoLC committed Jul 3, 2024
1 parent edffbba commit 2e0b6b2
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
CacheFirst,
NetworkFirst,
NetworkFirstOptions,
NetworkOnly,
StrategyOptions,
} from 'workbox-strategies';

Expand Down Expand Up @@ -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)
*/
Expand Down

0 comments on commit 2e0b6b2

Please sign in to comment.