Skip to content

Commit af304c0

Browse files
authored
Merge pull request Expensify#90163 from allgandalf/cleanup-open-domain-page
Use OpenDomainPage in domain initial page
2 parents ad6dec8 + ae0041e commit af304c0

5 files changed

Lines changed: 16 additions & 9 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type OpenDomainPageParams = {
2+
// The accountID of the domain whose data is being fetched
3+
domainAccountID: number;
4+
};
5+
6+
export default OpenDomainPageParams;

src/libs/API/parameters/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ export type {default as EnableGlobalReimbursementsForUSDBankAccountParams} from
487487
export type {default as SendReminderForCorpaySignerInformationParams} from './SendReminderForCorpaySignerInformationParams';
488488
export type {default as SendScheduleCallNudgeParams} from './SendScheduleCallNudge';
489489
export type {default as DomainParams} from './DomainParams';
490+
export type {default as OpenDomainPageParams} from './OpenDomainPageParams';
490491
export type {default as GetScimTokenParams} from './GetScimTokenParams';
491492
export type {default as SetSamlIdentityParams} from './SetSamlIdentityParams';
492493
export type {default as UpdateSamlEnabledParams} from './UpdateSamlEnabledParams';

src/libs/API/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ const READ_COMMANDS = {
12921292
GET_GUIDE_CALL_AVAILABILITY_SCHEDULE: 'GetGuideCallAvailabilitySchedule',
12931293
GET_TRANSACTIONS_FOR_MERGING: 'GetTransactionsForMerging',
12941294
GET_DOMAIN_VALIDATE_CODE: 'GetDomainValidateCode',
1295-
OPEN_DOMAIN_INITIAL_PAGE: 'OpenDomainInitialPage',
1295+
OPEN_DOMAIN_PAGE: 'OpenDomainPage',
12961296
GET_SAML_SETTINGS: 'GetSAMLSettings',
12971297
GET_DUPLICATE_TRANSACTION_DETAILS: 'GetDuplicateTransactionDetails',
12981298
GET_TRANSACTIONS_MATCHING_CODING_RULE: 'GetTransactionsMatchingCodingRule',
@@ -1390,7 +1390,7 @@ type ReadCommandParameters = {
13901390
[READ_COMMANDS.GET_TRANSACTIONS_FOR_MERGING]: Parameters.GetTransactionsForMergingParams;
13911391
[READ_COMMANDS.GET_SAML_SETTINGS]: Parameters.DomainParams;
13921392
[READ_COMMANDS.GET_DOMAIN_VALIDATE_CODE]: Parameters.DomainParams;
1393-
[READ_COMMANDS.OPEN_DOMAIN_INITIAL_PAGE]: Parameters.DomainParams;
1393+
[READ_COMMANDS.OPEN_DOMAIN_PAGE]: Parameters.OpenDomainPageParams;
13941394
[READ_COMMANDS.GET_DUPLICATE_TRANSACTION_DETAILS]: Parameters.GetDuplicateTransactionDetailsParams;
13951395
[READ_COMMANDS.GET_TRANSACTIONS_MATCHING_CODING_RULE]: Parameters.GetTransactionsMatchingCodingRuleParams;
13961396
[READ_COMMANDS.GET_ASSIGNED_SUPPORT_DATA]: null;

src/libs/actions/Domain.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ function resetDomainValidationError(accountID: number) {
117117
* Fetches the latest domain data from the server,
118118
* when accessing the domain initial page
119119
*/
120-
function openDomainInitialPage(domainName: string) {
121-
API.read(READ_COMMANDS.OPEN_DOMAIN_INITIAL_PAGE, {domainName});
120+
function openDomainPage(domainAccountID: number) {
121+
API.read(READ_COMMANDS.OPEN_DOMAIN_PAGE, {domainAccountID});
122122
}
123123

124124
/**
@@ -2299,7 +2299,7 @@ export {
22992299
getDomainValidationCode,
23002300
validateDomain,
23012301
resetDomainValidationError,
2302-
openDomainInitialPage,
2302+
openDomainPage,
23032303
getSamlSettings,
23042304
setSamlEnabled,
23052305
resetSamlEnabledError,

src/pages/domain/DomainInitialPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
2121
import useSingleExecution from '@hooks/useSingleExecution';
2222
import useThemeStyles from '@hooks/useThemeStyles';
2323
import useWaitForNavigation from '@hooks/useWaitForNavigation';
24-
import {openDomainInitialPage} from '@libs/actions/Domain';
24+
import {openDomainPage} from '@libs/actions/Domain';
2525
import {hasDomainAdminsErrors, hasDomainMembersErrors} from '@libs/DomainUtils';
2626
import Navigation from '@libs/Navigation/Navigation';
2727
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
@@ -90,11 +90,11 @@ function DomainInitialPage({route}: DomainInitialPageProps) {
9090
];
9191

9292
const fetchDomainData = useCallback(() => {
93-
if (!domainName) {
93+
if (!domainAccountID) {
9494
return;
9595
}
96-
openDomainInitialPage(domainName);
97-
}, [domainName]);
96+
openDomainPage(domainAccountID);
97+
}, [domainAccountID]);
9898

9999
useEffect(() => {
100100
fetchDomainData();

0 commit comments

Comments
 (0)