Skip to content

Commit

Permalink
Merge pull request #54722 from hungvu193/fix-update-ws-name
Browse files Browse the repository at this point in the history
[CP Staging] Update updateGeneralSettings params

(cherry picked from commit bdab650)

(CP triggered by Beamanator)
  • Loading branch information
Beamanator authored and OSBotify committed Jan 2, 2025
1 parent ff44f20 commit 627694f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ function clearAvatarErrors(policyID: string) {
* Optimistically update the general settings. Set the general settings as pending until the response succeeds.
* If the response fails set a general error message. Clear the error message when updating.
*/
function updateGeneralSettings(name: string, currencyValue?: string, policyID?: string) {
function updateGeneralSettings(policyID: string, name: string, currencyValue?: string) {
const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`];
if (!policy || !policyID) {
return;
Expand Down
5 changes: 4 additions & 1 deletion src/pages/workspace/WorkspaceProfileCurrencyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ function WorkspaceProfileCurrencyPage({policy}: WorkspaceProfileCurrencyPageProp
const {translate} = useLocalize();

const onSelectCurrency = (item: CurrencyListItem) => {
if (!policy) {
return;
}
FormActions.clearDraftValues(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM);
FormActions.setDraftValues(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM, {[COUNTRY]: mapCurrencyToCountry(item.currencyCode)});
Policy.updateGeneralSettings(policy?.name ?? '', item.currencyCode, policy?.id);
Policy.updateGeneralSettings(policy.id, policy?.name ?? '', item.currencyCode);
Navigation.setNavigationActionToMicrotaskQueue(Navigation.goBack);
};

Expand Down

0 comments on commit 627694f

Please sign in to comment.