Skip to content

Commit

Permalink
use correct onyx key to get data from
Browse files Browse the repository at this point in the history
  • Loading branch information
narefyev91 committed Nov 12, 2024
1 parent d737d7b commit 6e115b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/libs/actions/CompanyCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,13 @@ function updateCompanyCardName(workspaceAccountID: number, cardID: string, newCa
API.write(WRITE_COMMANDS.UPDATE_COMPANY_CARD_NAME, parameters, {optimisticData, finallyData, failureData});
}

function setCompanyCardExportAccount(policyID: string, workspaceAccountID: number, cardID: string, accountKey: string, newAccount: string) {
function setCompanyCardExportAccount(policyID: string, workspaceAccountID: number, cardID: string, accountKey: string, newAccount: string, bank: string) {
const authToken = NetworkStore.getAuthToken();

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.CARD_LIST,
key: `${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${bank}`,
value: {
[cardID]: {
nameValuePairs: {
Expand All @@ -519,7 +519,7 @@ function setCompanyCardExportAccount(policyID: string, workspaceAccountID: numbe
const finallyData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.CARD_LIST,
key: `${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${bank}`,
value: {
[cardID]: {
nameValuePairs: {
Expand All @@ -534,7 +534,7 @@ function setCompanyCardExportAccount(policyID: string, workspaceAccountID: numbe
const failureData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.CARD_LIST,
key: `${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${bank}`,
value: {
[cardID]: {
nameValuePairs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function WorkspaceCompanyCardAccountSelectCardPage({route}: WorkspaceCompanyCard
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);
const [searchText, setSearchText] = useState('');

const [allBankCards] = useOnyx(`${ONYXKEYS.CARD_LIST}`);
const [allBankCards] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${bank}`);
const card = allBankCards?.[cardID];
const connectedIntegration = PolicyUtils.getConnectedIntegration(policy) ?? CONST.POLICY.CONNECTIONS.NAME.QBO;
const exportMenuItem = getExportMenuItem(connectedIntegration, policyID, translate, policy, card);
Expand Down Expand Up @@ -63,7 +63,7 @@ function WorkspaceCompanyCardAccountSelectCardPage({route}: WorkspaceCompanyCard
if (!exportMenuItem?.exportType) {
return;
}
CompanyCards.setCompanyCardExportAccount(policyID, workspaceAccountID, cardID, exportMenuItem.exportType, value);
CompanyCards.setCompanyCardExportAccount(policyID, workspaceAccountID, cardID, exportMenuItem.exportType, value, bank);

Navigation.goBack(ROUTES.WORKSPACE_COMPANY_CARD_DETAILS.getRoute(policyID, cardID, bank));
},
Expand Down

0 comments on commit 6e115b2

Please sign in to comment.