Skip to content

Commit

Permalink
navigate to 2fa page
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane committed Jun 20, 2024
1 parent f710a3e commit cfcc93b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/components/ConnectToXeroButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import {removePolicyConnection} from '@libs/actions/connections';
import {getXeroSetupLink} from '@libs/actions/connections/ConnectToXero';
import Navigation from '@libs/Navigation/Navigation';
import * as Link from '@userActions/Link';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {ConnectToXeroButtonProps} from './types';

function ConnectToXeroButton({policyID, shouldDisconnectIntegrationBeforeConnecting, integrationToDisconnect}: ConnectToXeroButtonProps) {
Expand Down Expand Up @@ -64,7 +66,10 @@ function ConnectToXeroButton({policyID, shouldDisconnectIntegrationBeforeConnect
)}
{isRequire2FAModalOpen && (
<RequireTwoFactorAuthenticationModal
onConfirm={() => setIsRequire2FAModalOpen(false)}
onSubmit={() => {
setIsRequire2FAModalOpen(false);
Navigation.navigate(ROUTES.SETTINGS_2FA.getRoute(ROUTES.POLICY_ACCOUNTING.getRoute(policyID)));
}}
onCancel={() => setIsRequire2FAModalOpen(false)}
isVisible
description={translate('twoFactorAuth.twoFactorAuthIsRequiredDescriptionXero')}
Expand Down
9 changes: 5 additions & 4 deletions src/components/RequireTwoFactorAuthenticationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type IconAsset from '@src/types/utils/IconAsset';
import Button from './Button';
import ConfirmContent from './ConfirmContent';
Expand All @@ -17,7 +19,7 @@ import Text from './Text';

type RequireTwoFactorAuthenticationModalProps = {
/** A callback to call when the form has been submitted */
onConfirm: () => void;
onSubmit: () => void;

/** A callback to call when the form has been closed */
onCancel?: () => void;
Expand All @@ -35,15 +37,14 @@ type RequireTwoFactorAuthenticationModalProps = {
shouldEnableNewFocusManagement?: boolean;
};

function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description, isVisible, onConfirm, shouldEnableNewFocusManagement}: RequireTwoFactorAuthenticationModalProps) {
function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description, isVisible, onSubmit, shouldEnableNewFocusManagement}: RequireTwoFactorAuthenticationModalProps) {
const {shouldUseNarrowLayout} = useResponsiveLayout();
const styles = useThemeStyles();
const {translate} = useLocalize();
const StyleUtils = useStyleUtils();

return (
<Modal
onSubmit={onConfirm}
onClose={onCancel}
isVisible={isVisible}
type={shouldUseNarrowLayout ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
Expand All @@ -68,7 +69,7 @@ function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description,
large
success
pressOnEnter
onPress={() => {}}
onPress={onSubmit}
text={translate('twoFactorAuth.enableTwoFactorAuth')}
/>
</View>
Expand Down

0 comments on commit cfcc93b

Please sign in to comment.