From e31c45c44ea2ea762e57e280c26ce96bdde47f33 Mon Sep 17 00:00:00 2001 From: MidoriKurage Date: Sat, 21 Mar 2026 20:18:24 +0800 Subject: [PATCH] fix(frontend): Make sw.ts respect to frontend base URL --- frontend/src/sw.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/sw.ts b/frontend/src/sw.ts index b23613d4e..5e5862bb3 100644 --- a/frontend/src/sw.ts +++ b/frontend/src/sw.ts @@ -21,9 +21,11 @@ workbox.routing.registerRoute( new workbox.strategies.StaleWhileRevalidate(), ) +// Construct pattern with full base URL +const apiRoutePattern = new RegExp(`${fullBaseUrl.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}api\\/v1\\/.*$`) // Always send api requests through the network and bypass the browser's HTTP cache workbox.routing.registerRoute( - new RegExp('api\\/v1\\/.*$'), + apiRoutePattern, new workbox.strategies.NetworkOnly({ fetchOptions: { cache: 'no-store',