1
0
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:
Danny Coates 2019-03-13 12:07:59 -07:00
parent 555c615711
commit 017bb0d146
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB

View File

@ -9,6 +9,7 @@ async function getFxaConfig() {
if (fxaConfig && Date.now() - lastConfigRefresh < 1000 * 60 * 5) {
return fxaConfig;
}
try {
const res = await fetch(
`${config.fxa_url}/.well-known/openid-configuration`,
{ timeout: 3000 }
@ -16,6 +17,9 @@ async function getFxaConfig() {
fxaConfig = await res.json();
fxaConfig.key_scope = KEY_SCOPE;
lastConfigRefresh = Date.now();
} catch (e) {
// continue with previous fxaConfig
}
return fxaConfig;
}