Remove setCatchHandler
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
5357a7b6e2
commit
8c6b0003bc
|
@ -1,4 +1,4 @@
|
||||||
import { registerRoute, setCatchHandler } from "workbox-routing";
|
import { registerRoute } from "workbox-routing";
|
||||||
import {
|
import {
|
||||||
NetworkFirst,
|
NetworkFirst,
|
||||||
StaleWhileRevalidate,
|
StaleWhileRevalidate,
|
||||||
|
@ -10,7 +10,7 @@ import { CacheableResponsePlugin } from "workbox-cacheable-response";
|
||||||
// Used to limit entries in cache, remove entries after a certain period of time
|
// Used to limit entries in cache, remove entries after a certain period of time
|
||||||
import { ExpirationPlugin } from "workbox-expiration";
|
import { ExpirationPlugin } from "workbox-expiration";
|
||||||
|
|
||||||
import { precacheAndRoute, matchPrecache } from "workbox-precaching";
|
import { precacheAndRoute } from "workbox-precaching";
|
||||||
|
|
||||||
// Use with precache injection
|
// Use with precache injection
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
@ -18,18 +18,6 @@ import { precacheAndRoute, matchPrecache } from "workbox-precaching";
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
// eslint-disable-next-line no-underscore-dangle
|
||||||
precacheAndRoute(self.__WB_MANIFEST);
|
precacheAndRoute(self.__WB_MANIFEST);
|
||||||
|
|
||||||
// Catch routing errors, like if the user is offline
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
setCatchHandler(async ({ event }) => {
|
|
||||||
// Return the precached offline page if a document is being requested
|
|
||||||
if (event.request.destination === "document") {
|
|
||||||
return matchPrecache("/offline.html");
|
|
||||||
}
|
|
||||||
|
|
||||||
return Response.error();
|
|
||||||
});
|
|
||||||
|
|
||||||
registerRoute(
|
registerRoute(
|
||||||
// Check to see if the request is a navigation to a new page
|
// Check to see if the request is a navigation to a new page
|
||||||
({ request }) => request.mode === "navigate",
|
({ request }) => request.mode === "navigate",
|
||||||
|
|
Loading…
Reference in a new issue