Răsfoiți Sursa

优化pwa网络

Michael Wang 6 ani în urmă
părinte
comite
27b8edb8e5
1 a modificat fișierele cu 22 adăugiri și 3 ștergeri
  1. 22 3
      vue.config.js

+ 22 - 3
vue.config.js

@@ -94,14 +94,33 @@ module.exports = {
         },
         {
           // Match any same-origin request that contains 'api'.
-          // logo 可能每次都有更新
+          // 产品名称有可能每分钟都更新
           urlPattern: /\/api\/ecs_core\/org\/propertyNoSession\/OE_STUDENT_SYS_NAME\?domainName=/,
-          handler: "staleWhileRevalidate",
+          handler: "cacheFirst",
+          options: {
+            cacheableResponse: {
+              statuses: [0, 200],
+            },
+            cacheName: "sys-name-cache",
+            expiration: {
+              maxAgeSeconds: 60,
+            },
+          },
         },
         {
           // Match any same-origin request that contains 'api'.
+          // logo 每天更新一次
           urlPattern: /\/api\/ecs_core\/org\/logo\?domain=/,
-          handler: "staleWhileRevalidate",
+          handler: "cacheFirst",
+          options: {
+            cacheableResponse: {
+              statuses: [0, 200],
+            },
+            cacheName: "logo-cache",
+            expiration: {
+              maxAgeSeconds: 24 * 60 * 60,
+            },
+          },
         },
         {
           urlPattern: /\/models\/.*\.json/,