From 2fe5e7a8d79802fb79b9e528fb4acaf4f1b9faf9 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 7 Mar 2024 18:21:11 +0700 Subject: [PATCH] use OnyxEntry type --- src/components/LocalePicker.tsx | 2 +- src/libs/AccountUtils.ts | 5 +++-- src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/LocalePicker.tsx b/src/components/LocalePicker.tsx index c411ac7a02c9..b6e59643e499 100644 --- a/src/components/LocalePicker.tsx +++ b/src/components/LocalePicker.tsx @@ -35,7 +35,7 @@ function LocalePicker({account, preferredLocale = CONST.LOCALES.DEFAULT, size = keyForList: language, isSelected: preferredLocale === language, })); - const shouldDisablePicker = AccountUtils.isValidateCodeFormSubmitting(account ?? {}); + const shouldDisablePicker = AccountUtils.isValidateCodeFormSubmitting(account); return ( - account.isLoading && account.loadingForm === (account.requiresTwoFactorAuth ? CONST.FORMS.VALIDATE_TFA_CODE_FORM : CONST.FORMS.VALIDATE_CODE_FORM); +const isValidateCodeFormSubmitting = (account: OnyxEntry) => + account?.isLoading && account.loadingForm === (account.requiresTwoFactorAuth ? CONST.FORMS.VALIDATE_TFA_CODE_FORM : CONST.FORMS.VALIDATE_CODE_FORM); export default {isValidateCodeFormSubmitting}; diff --git a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx index fb7e1958ed7b..8111e8d39afa 100755 --- a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -77,7 +77,7 @@ function BaseValidateCodeForm({account, credentials, session, autoComplete, isUs const hasError = !!account && !isEmptyObject(account?.errors) && !needToClearError; const isLoadingResendValidationForm = account?.loadingForm === CONST.FORMS.RESEND_VALIDATE_CODE_FORM; const shouldDisableResendValidateCode = isOffline ?? account?.isLoading; - const isValidateCodeFormSubmitting = AccountUtils.isValidateCodeFormSubmitting(account ?? {}); + const isValidateCodeFormSubmitting = AccountUtils.isValidateCodeFormSubmitting(account); useEffect(() => { if (!(inputValidateCodeRef.current && hasError && (session?.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED || account?.isLoading))) {