fix: 修复 PWA 应用有密码时报错的问题

This commit is contained in:
涵曦 2024-11-14 00:51:53 +08:00
parent b4f0e7b349
commit 3fb0a3bae9

View File

@ -22,7 +22,6 @@ self.addEventListener('install', function(e) {
})
self.addEventListener('activate', function(e) {
// 判断地址是不是需要实时去请求,是就继续发送请求
console.log('Activate event')
e.waitUntil(
Promise.all(
@ -40,16 +39,3 @@ self.addEventListener('activate', function(e) {
)
})
self.addEventListener('fetch', function(e) {
// 匹配到缓存资源,就从缓存中返回数据
e.respondWith(
caches.match(e.request).then(function(response) {
if (response != null) {
console.log('Using cache for:', e.request.url)
return response
}
console.log('Fallback to fetch:', e.request.url)
return fetch(e.request.url)
})
)
})