mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-05 06:50:28 +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(
|
||||
(async (): Promise<Response> => {
|
||||
console.log('Unironic race condition mitigation it seems.');
|
||||
const client = await self.clients.get(event.clientId);
|
||||
let token: string | undefined;
|
||||
if (client) token = await askForAccessToken(client);
|
||||
|
||||
return fetch(url, fetchConfig(token));
|
||||
const token: string = await sendAndWaitForReply(client, 'token', {});
|
||||
const response = await fetch(url, fetchConfig(token));
|
||||
return response;
|
||||
})()
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue