Update sw.js

This commit is contained in:
Vaica committed 2026-06-22 15:36:56 +08:00
1 parent 8afb8a4756
commit ad1f7618ff
1 file changed
+3 -2
+3 -2
View File
@@ -1,4 +1,4 @@
const CACHE = 'v1'; const CACHE = 'v2';
const LOGIN = '/login'; const LOGIN = '/login';
const EXPIRE_MS = 3 * 60 * 60 * 1000; const EXPIRE_MS = 3 * 60 * 60 * 1000;
@@ -9,8 +9,9 @@ self.addEventListener('fetch', e => {
const req = e.request; const req = e.request;
const url = new URL(req.url); const url = new URL(req.url);
// 登录页、静态资源不拦截 // 登录页、静态资源、API 请求不拦截
if (url.pathname === '/login' || url.pathname.startsWith('/_next/') || if (url.pathname === '/login' || url.pathname.startsWith('/_next/') ||
url.pathname.startsWith('/api/') ||
url.pathname.endsWith('.js') || url.pathname.endsWith('.css') || url.pathname.endsWith('.js') || url.pathname.endsWith('.css') ||
url.pathname.endsWith('.ico') || url.pathname.endsWith('.woff2')) { url.pathname.endsWith('.ico') || url.pathname.endsWith('.woff2')) {
e.respondWith(fetch(req)); e.respondWith(fetch(req));