Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 3x | let isAuthV2 = null; export async function shouldUseAuthV2() { const url = '/meta/environment'; if (isAuthV2 !== null) { return isAuthV2; } try { const response = await fetch(url); if (response.ok) { const json = await response.json(); const value = json.data.find( (flag) => flag.environmentVariableName === 'FEATURE_AUTH_V2', ).evaluatedValue; isAuthV2 = value; return value; } throw new Error('unable to access /meta/environment'); } catch (error) { return false; } } |