Update sw.js
This commit is contained in:
1 parent
8afb8a4756
commit
ad1f7618ff
1 file changed
+3
-2
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user