mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-05 15:00:30 +03:00
Clean up fetch code
This commit is contained in:
parent
3b62beabf1
commit
1d4864592f
1 changed files with 4 additions and 4 deletions
|
|
@ -65,11 +65,11 @@ self.addEventListener('fetch', (event: FetchEvent) => {
|
||||||
}
|
}
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
(async (): Promise<Response> => {
|
(async (): Promise<Response> => {
|
||||||
|
console.log('Unironic race condition mitigation it seems.');
|
||||||
const client = await self.clients.get(event.clientId);
|
const client = await self.clients.get(event.clientId);
|
||||||
let token: string | undefined;
|
const token: string = await sendAndWaitForReply(client, 'token', {});
|
||||||
if (client) token = await askForAccessToken(client);
|
const response = await fetch(url, fetchConfig(token));
|
||||||
|
return response;
|
||||||
return fetch(url, fetchConfig(token));
|
|
||||||
})()
|
})()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue