Set up initial frontend with Vite and integrated Docker for full-stack build

This commit is contained in:
alexandre grondin
2026-04-19 22:24:59 +02:00
commit ac63c4be99
37 changed files with 9796 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
const CACHE = "budget-commun-v2";
const ASSETS = ["/", "/index.html", "/manifest.json"];
self.addEventListener("install", e => {
e.waitUntil(caches.open(CACHE).then(c => c.addAll(ASSETS)));
self.skipWaiting();
});
self.addEventListener("activate", e => {
e.waitUntil(caches.keys().then(keys =>
Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k)))
));
self.clients.claim();
});
self.addEventListener("fetch", e => {
// API calls: network only
if (e.request.url.includes("/api/")) return;
// Static: cache first
e.respondWith(
caches.match(e.request).then(cached => cached || fetch(e.request))
);
});