diff --git a/src/session/appRouter/getFlag.js b/src/session/appRouter/getFlag.js index 1bf1b23..c8e0ee1 100644 --- a/src/session/appRouter/getFlag.js +++ b/src/session/appRouter/getFlag.js @@ -6,16 +6,11 @@ const flagDataTypeMap = { b: 'boolean' }; -const getClaimValue = (claim) => { - const obj = getClaim(claim); - return obj && obj.value; -}; - export const getFlag = (code, defaultValue, flagType) => { - const flags = getClaimValue('feature_flags'); + const flags = getClaim('feature_flags'); const flag = flags && flags[code] ? flags[code] : {}; - if (!flag.v && !defaultValue) { + if (!flag.v && defaultValue == undefined) { throw Error( `Flag ${code} was not found, and no default value has been provided` ); diff --git a/src/session/pagesRouter/getFlag.js b/src/session/pagesRouter/getFlag.js index 1b5ad56..c8e0ee1 100644 --- a/src/session/pagesRouter/getFlag.js +++ b/src/session/pagesRouter/getFlag.js @@ -6,16 +6,11 @@ const flagDataTypeMap = { b: 'boolean' }; -const getClaimValue = (claim, tokenKey = 'access_token') => { - const obj = getClaim(claim, tokenKey); - return obj && obj.value; -}; - export const getFlag = (code, defaultValue, flagType) => { - const flags = getClaimValue('feature_flags'); + const flags = getClaim('feature_flags'); const flag = flags && flags[code] ? flags[code] : {}; - if (!flag.v && !defaultValue) { + if (!flag.v && defaultValue == undefined) { throw Error( `Flag ${code} was not found, and no default value has been provided` );