fix: transaction locking handling

This commit is contained in:
Ahmed Bouhuolia
2025-12-05 23:47:29 +02:00
parent bc21dcb37e
commit d006362be2
7 changed files with 60 additions and 58 deletions

View File

@@ -69,7 +69,7 @@ function GlobalErrors({
if (globalErrors.transactionsLocked) {
AppToaster.show({
message: intl.get('global_error.transactions_locked', {
lockedToDate: globalErrors.transactionsLocked.formatted_locked_to_date,
lockedToDate: globalErrors.transactionsLocked.formattedLockedToDate,
}),
intent: Intent.DANGER,
onDismiss: () => {

View File

@@ -64,12 +64,11 @@ export default function useApiRequest() {
setGlobalErrors({ too_many_requests: true });
}
if (status === 400) {
if (
data.errors.find(
(error) => error.type === 'TRANSACTIONS_DATE_LOCKED',
)
) {
setGlobalErrors({ transactionsLocked: { ...lockedError.data } });
const lockedError = data.errors.find(
(error) => error.type === 'TRANSACTIONS_DATE_LOCKED',
);
if (lockedError) {
setGlobalErrors({ transactionsLocked: { ...lockedError.payload } });
}
if (
data.errors.find(