Skip to content

Commit

Permalink
Merge pull request #46311 from Expensify/rodrigo-fix-query-param-export
Browse files Browse the repository at this point in the history
Fix name of query parameter in ExportSearchItemsToCSV
  • Loading branch information
rlinoz authored Jul 26, 2024
2 parents 9abde9e + 0be3125 commit a0aad97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/Search/SearchPageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ function SearchPageHeader({
return;
}

SearchActions.exportSearchItemsToCSV(status, selectedReports, selectedTransactionsKeys, [activeWorkspaceID ?? ''], () => {
const reportIDList = (selectedReports?.filter((report) => !!report) as string[]) ?? [];
SearchActions.exportSearchItemsToCSV({query: status, reportIDList, transactionIDList: selectedTransactionsKeys, policyIDs: [activeWorkspaceID ?? '']}, () => {
setDownloadErrorModalOpen?.();
});
},
Expand Down
8 changes: 4 additions & 4 deletions src/libs/actions/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {OnyxUpdate} from 'react-native-onyx';
import type {FormOnyxValues} from '@components/Form/types';
import type {SearchQueryString} from '@components/Search/types';
import * as API from '@libs/API';
import type {SearchParams} from '@libs/API/parameters';
import type {ExportSearchItemsToCSVParams, SearchParams} from '@libs/API/parameters';
import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import * as ApiUtils from '@libs/ApiUtils';
import fileDownload from '@libs/fileDownload';
Expand Down Expand Up @@ -106,11 +106,11 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) {
API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList}, {optimisticData, finallyData});
}

type Params = Record<string, string | string[]>;
type Params = Record<string, ExportSearchItemsToCSVParams>;

function exportSearchItemsToCSV(status: string, reportIDList: Array<string | undefined> | undefined, transactionIDList: string[], policyIDs: string[], onDownloadFailed: () => void) {
function exportSearchItemsToCSV({query, reportIDList, transactionIDList, policyIDs}: ExportSearchItemsToCSVParams, onDownloadFailed: () => void) {
const finalParameters = enhanceParameters(WRITE_COMMANDS.EXPORT_SEARCH_ITEMS_TO_CSV, {
status,
query,
reportIDList,
transactionIDList,
policyIDs,
Expand Down

0 comments on commit a0aad97

Please sign in to comment.