Skip to content

Commit

Permalink
Merge pull request #30 from thisyahlen-deriv/thisyahlen/fix-undefined…
Browse files Browse the repository at this point in the history
…-length

chore: fix undefined length
  • Loading branch information
amam-deriv authored Sep 20, 2024
2 parents 14ec1d2 + aed0a36 commit 8368092
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useIsOAuth2Enabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ type hydraBEApps = {
* @returns {boolean} - a boolean indicating whether OAuth2 is enabled for the current app id
*/
export const useIsOAuth2Enabled = (
OAuth2EnabledApps: hydraBEApps[],
OAuth2EnabledApps: hydraBEApps[] = [],
OAuth2EnabledAppsInitialised: boolean
): boolean => {
const [isOAuth2Enabled, setIsOAuth2Enabled] = useState<boolean>(false);
const { appId } = getServerInfo();

useEffect(() => {
if (OAuth2EnabledAppsInitialised) {
const FEHydraAppIds = OAuth2EnabledApps.length
const FEHydraAppIds = OAuth2EnabledApps?.length
? (OAuth2EnabledApps[OAuth2EnabledApps.length - 1]?.enabled_for ?? [])
: [];
setIsOAuth2Enabled(FEHydraAppIds.includes(+(appId as string)));
Expand Down

0 comments on commit 8368092

Please sign in to comment.