mirror of
https://github.com/cinnyapp/cinny.git
synced 2024-11-20 06:49:52 +01:00
fix: register service worker immediately and cache media requests (#1977)
* Allow service worker to immediately claim pages * Allow media requests to be cached by browser
This commit is contained in:
parent
35b0b1ea42
commit
0e51e19cab
1 changed files with 5 additions and 0 deletions
|
@ -23,9 +23,14 @@ function fetchConfig(token?: string): RequestInit | undefined {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
|
cache: 'default',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.addEventListener('activate', (event: ExtendableEvent) => {
|
||||||
|
event.waitUntil(clients.claim());
|
||||||
|
});
|
||||||
|
|
||||||
self.addEventListener('fetch', (event: FetchEvent) => {
|
self.addEventListener('fetch', (event: FetchEvent) => {
|
||||||
const { url, method } = event.request;
|
const { url, method } = event.request;
|
||||||
if (method !== 'GET') return;
|
if (method !== 'GET') return;
|
||||||
|
|
Loading…
Reference in a new issue