Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/libs/actions/Travel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Onyx from 'react-native-onyx';
import * as API from '@libs/API';
import type {AcceptSpotnanaTermsParams} from '@libs/API/parameters';
import {SIDE_EFFECT_REQUEST_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import {getMicroSecondOnyxErrorWithTranslationKey} from '@libs/ErrorUtils';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';

Expand Down Expand Up @@ -61,7 +60,6 @@ function acceptSpotnanaTerms(domain?: string, policyID?: string) {
key: ONYXKEYS.TRAVEL_PROVISIONING,
value: {
isLoading: false,
errors: getMicroSecondOnyxErrorWithTranslationKey('travel.errorMessage'),
},
},
];
Expand Down
6 changes: 4 additions & 2 deletions src/pages/Travel/DynamicTravelTerms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function DynamicTravelTerms({route}: TravelTermsPageProps) {
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.TRAVEL_TCS.path);

const errorMessage = travelProvisioning?.errors && !travelProvisioning?.error ? getLatestErrorMessage(travelProvisioning) : '';
const errorMessage = getLatestErrorMessage(travelProvisioning);
const isLoading = travelProvisioning?.isLoading;
const domain = route.params.domain === CONST.TRAVEL.DEFAULT_DOMAIN ? undefined : route.params.domain;
const policyID = route.params.policyID;
Expand Down Expand Up @@ -95,6 +95,8 @@ function DynamicTravelTerms({route}: TravelTermsPageProps) {

// Handle verification required error - show modal and reject to close Safari window if open
if (errorCode === CONST.TRAVEL.PROVISIONING.ERROR_ADDITIONAL_VERIFICATION_REQUIRED) {
// The modal communicates the error, so clear the provisioning error to avoid also showing it inline behind the modal
cleanupTravelProvisioningSession();
showConfirmModal({
title: translate('travel.verifyCompany.title'),
titleStyles: styles.textHeadlineH1,
Expand All @@ -117,7 +119,7 @@ function DynamicTravelTerms({route}: TravelTermsPageProps) {
return Promise.reject(new Error('Verification required'));
}

// Handle general API failure
// Any other backend failure surfaces its error inline via the travelProvisioning Onyx key set by the backend
if (response?.jsonCode !== 200) {
return Promise.reject(new Error('Request failed'));
}
Expand Down
Loading