Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] Fix name of query parameter in ExportSearchItemsToCSV #46311

Merged
merged 1 commit into from
Jul 26, 2024
Merged
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
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
Loading