diff options
author | crupest <crupest@outlook.com> | 2020-11-15 20:59:14 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-11-15 20:59:14 +0800 |
commit | 6681586505bccac7ef2cb0df850c4fde10eba8b4 (patch) | |
tree | 5249efa03f82b517f9f1645d077ba7e29bac3e40 | |
parent | dbc05b79c94894b25cbbb23025ed91dd1cf8a7a3 (diff) | |
download | timeline-6681586505bccac7ef2cb0df850c4fde10eba8b4.tar.gz timeline-6681586505bccac7ef2cb0df850c4fde10eba8b4.tar.bz2 timeline-6681586505bccac7ef2cb0df850c4fde10eba8b4.zip |
fix: Fix #182 .
-rw-r--r-- | FrontEnd/src/sw/sw.ts | 8 |
1 files changed, 6 insertions, 2 deletions
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") |