aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-15 20:59:14 +0800
committercrupest <crupest@outlook.com>2020-11-15 20:59:14 +0800
commita57fa846f70514662f807462eeea66bc504540f9 (patch)
tree0fd14a57889975fc46b9053a0684a99b055aecde
parent515430ecc976008c50cf27a38dc869c2b1aa73c0 (diff)
downloadtimeline-a57fa846f70514662f807462eeea66bc504540f9.tar.gz
timeline-a57fa846f70514662f807462eeea66bc504540f9.tar.bz2
timeline-a57fa846f70514662f807462eeea66bc504540f9.zip
fix: Fix #182 .
-rw-r--r--FrontEnd/src/sw/sw.ts8
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")