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));