diff --git a/src/entryPoints/AuthModule/Common/CommonInviteScreen.res b/src/entryPoints/AuthModule/Common/CommonInviteScreen.res index 0fde0100e..7faad2b31 100644 --- a/src/entryPoints/AuthModule/Common/CommonInviteScreen.res +++ b/src/entryPoints/AuthModule/Common/CommonInviteScreen.res @@ -5,7 +5,7 @@ let make = (~merchantData, ~acceptInviteOnClick, ~onClickLoginToDashboard) => { let textHeadingClass = getTextClass((H2, Optional)) let textSubHeadingClass = getTextClass((P1, Regular)) - let {setAuthStatus} = React.useContext(AuthInfoProvider.authStatusContext) + let handleLogout = APIUtils.useHandleLogout() let isAtleastOneAccept = React.useMemo(() => { merchantData ->Array.find(ele => ele->getDictFromJsonObject->getBool("is_active", false)) @@ -78,7 +78,7 @@ let make = (~merchantData, ~acceptInviteOnClick, ~onClickLoginToDashboard) => { {"Log in with a different account?"->React.string}
setAuthStatus(LoggedOut)}> + onClick={_ => handleLogout()->ignore}> {"Click here to log out."->React.string}
diff --git a/src/entryPoints/AuthModule/PreLoginModule/ListInvitationScreen.res b/src/entryPoints/AuthModule/PreLoginModule/ListInvitationScreen.res index d781993ec..af61260fb 100644 --- a/src/entryPoints/AuthModule/PreLoginModule/ListInvitationScreen.res +++ b/src/entryPoints/AuthModule/PreLoginModule/ListInvitationScreen.res @@ -13,6 +13,7 @@ let make = () => { let {setAuthStatus} = React.useContext(AuthInfoProvider.authStatusContext) let (acceptedInvites, setAcceptedInvites) = React.useState(_ => []) let (pendindInvites, setPendingInvites) = React.useState(_ => []) + let handleLogout = useHandleLogout() let getListOfMerchantIds = async () => { try { @@ -122,7 +123,7 @@ let make = () => { {"Log in with a different account?"->React.string}setAuthStatus(LoggedOut)}> + onClick={_ => handleLogout()->ignore}> {"Click here to log out."->React.string}
diff --git a/src/entryPoints/AuthModule/TwoFaAuth/TotpSetup.res b/src/entryPoints/AuthModule/TwoFaAuth/TotpSetup.res index 34039bf83..3495b88dc 100644 --- a/src/entryPoints/AuthModule/TwoFaAuth/TotpSetup.res +++ b/src/entryPoints/AuthModule/TwoFaAuth/TotpSetup.res @@ -246,7 +246,7 @@ let make = (~setTwoFaPageState, ~twoFaPageState, ~errorHandling, ~isSkippable) = let getURL = APIUtils.useGetURL() let showToast = ToastState.useShowToast() let fetchDetails = APIUtils.useGetMethod() - + let handleLogout = APIUtils.useHandleLogout() let {setAuthStatus} = React.useContext(AuthInfoProvider.authStatusContext) let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let (isQrVisible, setIsQrVisible) = React.useState(_ => false) @@ -362,7 +362,7 @@ let make = (~setTwoFaPageState, ~twoFaPageState, ~errorHandling, ~isSkippable) = {"Log in with a different account?"->React.string}setAuthStatus(LoggedOut)}> + onClick={_ => handleLogout()->ignore}> {"Click here to log out."->React.string}
diff --git a/src/entryPoints/AuthModule/TwoFaAuth/TwoFaLanding.res b/src/entryPoints/AuthModule/TwoFaAuth/TwoFaLanding.res index c48ee9a24..5861ba2c2 100644 --- a/src/entryPoints/AuthModule/TwoFaAuth/TwoFaLanding.res +++ b/src/entryPoints/AuthModule/TwoFaAuth/TwoFaLanding.res @@ -5,8 +5,7 @@ module AttemptsExpiredComponent = { let make = (~expiredType, ~setTwoFaPageState, ~setTwoFaStatus) => { open TwoFaTypes open HSwitchUtils - let {setAuthStatus} = React.useContext(AuthInfoProvider.authStatusContext) - + let handleLogout = APIUtils.useHandleLogout() let expiredComponent = switch expiredType { | TOTP_ATTEMPTS_EXPIRED =>setAuthStatus(LoggedOut)}> + onClick={_ => handleLogout()->ignore}> {"Click here to log out."->React.string}