Skip to content

Commit

Permalink
refactor(typescript): apply pull request feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pac-guerreiro committed Jan 17, 2024
1 parent 51a21e5 commit 2d65ac5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/pages/ValidateLoginPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {ValidateLoginPageOnyxNativeProps, ValidateLoginPageProps} from './t

function ValidateLoginPage({
route: {
params: {accountID = '', validateCode = ''},
params: {accountID, validateCode},
},
session,
}: ValidateLoginPageProps<ValidateLoginPageOnyxNativeProps>) {
Expand Down
15 changes: 10 additions & 5 deletions src/pages/ValidateLoginPage/index.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ValidateLoginPageOnyxProps, ValidateLoginPageProps} from './types';

function ValidateLoginPage({account, credentials, route, session}: ValidateLoginPageProps<ValidateLoginPageOnyxProps>) {
function ValidateLoginPage({
account,
credentials,
route: {
params: {accountID, validateCode},
},
session,
}: ValidateLoginPageProps<ValidateLoginPageOnyxProps>) {
const login = credentials?.login;
const autoAuthState = session?.autoAuthState ?? CONST.AUTO_AUTH_STATE.NOT_STARTED;
const accountID = Number(route?.params.accountID) ?? -1;
const validateCode = route.params.validateCode ?? '';
const isSignedIn = !!session?.authToken;
const is2FARequired = !!account?.requiresTwoFactorAuth;
const cachedAccountID = credentials?.accountID;
Expand All @@ -32,7 +37,7 @@ function ValidateLoginPage({account, credentials, route, session}: ValidateLogin
}

// The user has initiated the sign in process on the same browser, in another tab.
Session.signInWithValidateCode(accountID, validateCode);
Session.signInWithValidateCode(Number(accountID), validateCode);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Expand All @@ -52,7 +57,7 @@ function ValidateLoginPage({account, credentials, route, session}: ValidateLogin
{autoAuthState === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN && isSignedIn && <JustSignedInModal is2FARequired={false} />}
{autoAuthState === CONST.AUTO_AUTH_STATE.NOT_STARTED && (
<ValidateCodeModal
accountID={accountID}
accountID={Number(accountID)}
code={validateCode}
/>
)}
Expand Down

0 comments on commit 2d65ac5

Please sign in to comment.