当我在线使用Angular应用程序时,服务工作程序已激活并正在运行。因此,每个API请求都存储在缓存中。
但是当我离线时,缓存中存储的每个API都会出错:
504网关超时(来自服务人员)
您认为这是因为Service Worker不使用缓存吗?
请找到我的ngsw-config.json
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.png",
"/index.html"
]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/*",
"/*.css",
"/*.js",
"/*.woff2",
"/*.woff",
"/*.ttf"
]
}
}
],
"dataGroups": [
{
"name": "common",
"urls": [
"/api/common/1.0.0/users/me",
"/api/common/1.0.0/plants"
],
"cacheConfig": {
"maxSize": 10000,
"maxAge": "1d",
"timeout": "2s",
"strategy": "freshness"
}
},
{
"name": "common-lookups",
"urls": [
"/api/common/1.0.0/lookups?*",
"/api/common/1.0.0/plants/*",
"/api/common/1.0.0/vehicleModels",
"/api/common/1.0.0/zones/*"
],
"cacheConfig": {
"maxSize": 10000,
"maxAge": "1d",
"timeout": "2s",
"strategy": "freshness"
}
},
{
"name": "5s",
"urls": [
"/api/5s/1.0.0/audits?*",
"/api/5s/1.0.0/audits/*",
"/api/5s/1.0.0/categories"
],
"cacheConfig": {
"maxSize": 10000,
"maxAge": "1d",
"timeout": "2s",
"strategy": "freshness"
}
},
{
"name": "jo",
"urls": [
"/api/jo/1.0.0/*",
"/api/jo/1.0.0/jobObservations/*"
],
"cacheConfig": {
"maxSize": 1000,
"maxAge": "1d",
"timeout": "2s",
"strategy": "freshness"
}
}
]
}