From 0a84843aa3bad17ac862c7f0f27b3570534f20b9 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Tue, 13 Sep 2022 13:01:51 -0700 Subject: [PATCH] remove usages of onyxRates --- src/libs/actions/Policy.js | 8 ++++---- .../workspace/reimburse/WorkspaceReimburseView.js | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index d8af8be7d7f1..5fac77a56380 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -529,7 +529,7 @@ function clearCustomUnitErrors(policyID, customUnitID, customUnitRateID) { [customUnitID]: { errors: null, pendingAction: null, - onyxRates: { + rates: { [customUnitRateID]: { errors: null, pendingAction: null, @@ -626,7 +626,7 @@ function updateCustomUnitRate(policyID, currentCustomUnitRate, customUnitID, new value: { customUnits: { [customUnitID]: { - onyxRates: { + rates: { [newCustomUnitRate.customUnitRateID]: { ...newCustomUnitRate, errors: null, @@ -646,7 +646,7 @@ function updateCustomUnitRate(policyID, currentCustomUnitRate, customUnitID, new value: { customUnits: { [customUnitID]: { - onyxRates: { + rates: { [newCustomUnitRate.customUnitRateID]: { pendingAction: null, }, @@ -664,7 +664,7 @@ function updateCustomUnitRate(policyID, currentCustomUnitRate, customUnitID, new value: { customUnits: { [customUnitID]: { - onyxRates: { + rates: { [currentCustomUnitRate.customUnitRateID]: { ...currentCustomUnitRate, errors: { diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseView.js b/src/pages/workspace/reimburse/WorkspaceReimburseView.js index cead7dbc828a..37ddbfee899c 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimburseView.js +++ b/src/pages/workspace/reimburse/WorkspaceReimburseView.js @@ -40,7 +40,7 @@ const propTypes = { attributes: PropTypes.shape({ unit: PropTypes.string, }), - onyxRates: PropTypes.objectOf( + rates: PropTypes.objectOf( PropTypes.shape({ customUnitRateID: PropTypes.string, name: PropTypes.string, @@ -63,7 +63,7 @@ class WorkspaceReimburseView extends React.Component { constructor(props) { super(props); const distanceCustomUnit = _.find(lodashGet(props, 'policy.customUnits', {}), unit => unit.name === 'Distance'); - const customUnitRate = _.find(lodashGet(distanceCustomUnit, 'onyxRates', {}), rate => rate.name === 'Default Rate'); + const customUnitRate = _.find(lodashGet(distanceCustomUnit, 'rates', {}), rate => rate.name === 'Default Rate'); this.state = { unitID: lodashGet(distanceCustomUnit, 'customUnitID', ''), @@ -99,7 +99,7 @@ class WorkspaceReimburseView extends React.Component { .values() .findWhere({name: CONST.CUSTOM_UNITS.NAME_DISTANCE}) .value(); - const customUnitRate = _.find(lodashGet(distanceCustomUnit, 'onyxRates', {}), rate => rate.name === 'Default Rate'); + const customUnitRate = _.find(lodashGet(distanceCustomUnit, 'rates', {}), rate => rate.name === 'Default Rate'); this.setState({ unitID: lodashGet(distanceCustomUnit, 'customUnitID', ''), unitName: lodashGet(distanceCustomUnit, 'name', ''), @@ -177,7 +177,7 @@ class WorkspaceReimburseView extends React.Component { }); const distanceCustomUnit = _.find(lodashGet(this.props, 'policy.customUnits', {}), unit => unit.name === 'Distance'); - const currentCustomUnitRate = lodashGet(distanceCustomUnit, ['onyxRates', this.state.unitRateID], {}); + const currentCustomUnitRate = lodashGet(distanceCustomUnit, ['rates', this.state.unitRateID], {}); Policy.updateCustomUnitRate(this.props.policyID, currentCustomUnitRate, this.state.unitID, { ...currentCustomUnitRate, rate: numValue.toFixed(3) * CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET, @@ -223,10 +223,10 @@ class WorkspaceReimburseView extends React.Component { Policy.clearCustomUnitErrors(this.props.policyID, this.state.unitID, this.state.unitRateID)} >