Skip to content

Commit

Permalink
optimize: add settings version for optimistic locking issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Nov 1, 2023
1 parent 3eed623 commit e2f626a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const BankingInformationSettings = () => {
enabled,
key,
id: bankingInformationId,
version,
isLoading,
refetch,
} = useBankingInformation();
Expand All @@ -22,7 +23,7 @@ const BankingInformationSettings = () => {
const onSubmit = async ({ value }) => {
try {
await ky.put(`${SETTINGS_API}/${bankingInformationId}`, {
json: { value, key },
json: { value, key, _version: version },
});

refetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const BankingInformationSettingsForm = ({
<Col xs={12}>
<Field
component={Checkbox}
label={<FormattedMessage id="ui-organizations.settings.bankingInformation" />}
label={<FormattedMessage id="ui-organizations.settings.bankingInformation.enable" />}
name="value"
type="checkbox"
/>
Expand Down
1 change: 1 addition & 0 deletions src/Settings/hooks/useBankingInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const useBankingInformation = () => {
id: bankingInformation.id,
enabled: bankingInformation.value === 'true',
key: bankingInformation.key,
version: bankingInformation._version,
isLoading,
refetch,
});
Expand Down
1 change: 1 addition & 0 deletions translations/ui-organizations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
"settings.typeStatus.Active": "Active",
"settings.typeStatus.Inactive": "Inactive",
"settings.bankingInformation": "Banking information",
"settings.bankingInformation.enable": "Enable banking information",
"settings.bankingAccountTypes": "Account types",
"settings.bankingAccountTypes.cannotDeleteTermHeader": "Cannot delete account type",
"settings.bankingAccountTypes.cannotDeleteTermMessage": "This account type cannot be deleted, as it is in use by one or more records.",
Expand Down

0 comments on commit e2f626a

Please sign in to comment.