mirror of
https://gitlab.com/timvisee/send.git
synced 2024-11-08 20:22:45 +01:00
wrap openid-config request in try/catch
This commit is contained in:
parent
555c615711
commit
017bb0d146
@ -9,13 +9,17 @@ async function getFxaConfig() {
|
|||||||
if (fxaConfig && Date.now() - lastConfigRefresh < 1000 * 60 * 5) {
|
if (fxaConfig && Date.now() - lastConfigRefresh < 1000 * 60 * 5) {
|
||||||
return fxaConfig;
|
return fxaConfig;
|
||||||
}
|
}
|
||||||
const res = await fetch(
|
try {
|
||||||
`${config.fxa_url}/.well-known/openid-configuration`,
|
const res = await fetch(
|
||||||
{ timeout: 3000 }
|
`${config.fxa_url}/.well-known/openid-configuration`,
|
||||||
);
|
{ timeout: 3000 }
|
||||||
fxaConfig = await res.json();
|
);
|
||||||
fxaConfig.key_scope = KEY_SCOPE;
|
fxaConfig = await res.json();
|
||||||
lastConfigRefresh = Date.now();
|
fxaConfig.key_scope = KEY_SCOPE;
|
||||||
|
lastConfigRefresh = Date.now();
|
||||||
|
} catch (e) {
|
||||||
|
// continue with previous fxaConfig
|
||||||
|
}
|
||||||
return fxaConfig;
|
return fxaConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user