From 1c22c2c227e60c39b083ad1bb203f23a83888c6c Mon Sep 17 00:00:00 2001 From: Elmar Kresse Date: Sun, 19 May 2024 21:29:39 +0200 Subject: [PATCH] feat:#4 updated cache and workbox --- frontend/index.html | 3 ++- frontend/src/vite-env.d.ts | 2 ++ frontend/vite.config.ts | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index b4cdc0c..354a812 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -11,7 +11,8 @@ - + . /// + +declare module 'ical.js'; \ No newline at end of file diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 0e9baec..85f1c19 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -67,7 +67,21 @@ export default defineConfig({ registerType: 'autoUpdate', workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg,json,vue,txt,woff2}'], - cleanupOutdatedCaches: true + cleanupOutdatedCaches: true, + runtimeCaching: [ + { + urlPattern: /^https?.*/, + handler: 'NetworkFirst', + options: { + cacheName: 'https-calls', + expiration: { + maxEntries: 150, + maxAgeSeconds: 30 * 12 * 60 * 60, // 1 month + }, + networkTimeoutSeconds: 10, // fall back to cache if api does not response within 10 seconds + }, + }, + ], }, devOptions: { enabled: true,