Remove setCatchHandler
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
973194cd59
commit
f1aac86bfb
|
@ -1,4 +1,4 @@
|
|||
import { registerRoute, setCatchHandler } from "workbox-routing";
|
||||
import { registerRoute } from "workbox-routing";
|
||||
import {
|
||||
NetworkFirst,
|
||||
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
|
||||
import { ExpirationPlugin } from "workbox-expiration";
|
||||
|
||||
import { precacheAndRoute, matchPrecache } from "workbox-precaching";
|
||||
import { precacheAndRoute } from "workbox-precaching";
|
||||
|
||||
// Use with precache injection
|
||||
// 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
|
||||
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(
|
||||
// Check to see if the request is a navigation to a new page
|
||||
({ request }) => request.mode === "navigate",
|
||||
|
|
Loading…
Reference in New Issue