From a320ff2661d859ed827ec60850c38728e471896e Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Mon, 22 Jun 2026 15:36:56 +0800 Subject: [PATCH] Update sw.js --- write-server/nginx/sw.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/write-server/nginx/sw.js b/write-server/nginx/sw.js index ee2d50c5..cba82dc9 100644 --- a/write-server/nginx/sw.js +++ b/write-server/nginx/sw.js @@ -1,4 +1,4 @@ -const CACHE = 'v1'; +const CACHE = 'v2'; const LOGIN = '/login'; const EXPIRE_MS = 3 * 60 * 60 * 1000; @@ -9,8 +9,9 @@ self.addEventListener('fetch', e => { const req = e.request; const url = new URL(req.url); - // 登录页、静态资源不拦截 + // 登录页、静态资源、API 请求不拦截 if (url.pathname === '/login' || url.pathname.startsWith('/_next/') || + url.pathname.startsWith('/api/') || url.pathname.endsWith('.js') || url.pathname.endsWith('.css') || url.pathname.endsWith('.ico') || url.pathname.endsWith('.woff2')) { e.respondWith(fetch(req));