Remove setCatchHandler

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-05-06 18:03:34 +02:00
parent 5357a7b6e2
commit 8c6b0003bc
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 2 additions and 14 deletions

View File

@ -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",