Set up initial frontend with Vite and integrated Docker for full-stack build
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||
<rect width="32" height="32" rx="8" fill="#1a1814"/>
|
||||
<text x="16" y="22" text-anchor="middle" font-family="serif" font-size="18" font-weight="700" fill="#e8b86d">B</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 243 B |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
@@ -0,0 +1,32 @@
|
||||
const CACHE = 'budget-commun-v3'
|
||||
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 : réseau uniquement, jamais de cache
|
||||
if (e.request.url.includes('/api/')) return
|
||||
|
||||
// Assets statiques : network first → cache en fallback offline
|
||||
e.respondWith(
|
||||
fetch(e.request)
|
||||
.then(response => {
|
||||
const clone = response.clone()
|
||||
caches.open(CACHE).then(c => c.put(e.request, clone))
|
||||
return response
|
||||
})
|
||||
.catch(() => caches.match(e.request))
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user