From 6681586505bccac7ef2cb0df850c4fde10eba8b4 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 15 Nov 2020 20:59:14 +0800 Subject: fix: Fix #182 . --- FrontEnd/src/sw/sw.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'FrontEnd/src') diff --git a/FrontEnd/src/sw/sw.ts b/FrontEnd/src/sw/sw.ts index d6202f36..b5225ec4 100644 --- a/FrontEnd/src/sw/sw.ts +++ b/FrontEnd/src/sw/sw.ts @@ -14,10 +14,14 @@ precacheAndRoute(self.__WB_MANIFEST); const networkOnly = new NetworkOnly(); +const networkOnlyPaths = ["/api", "/swagger"]; + setDefaultHandler((options) => { const { request, url } = options; - if (url && url.pathname.startsWith("/api/")) { - return networkOnly.handle(options); + if (url) { + for (const p of networkOnlyPaths) { + if (url.pathname.startsWith(p)) return networkOnly.handle(options); + } } if (request instanceof Request && request.destination === "document") -- cgit v1.2.3