feat: handle error message.

This commit is contained in:
elforjani13
2021-12-07 20:56:54 +02:00
parent 78c42acb17
commit 14f33c667b
3 changed files with 45 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
import React from 'react';
import intl from 'react-intl-universal';
import { Intent } from '@blueprintjs/core';
import { AppToaster } from 'components';
export const handleDeleteErrors = (errors) => {
if (
errors.find((error) => error.type === 'CREDIT_NOTE_HAS_APPLIED_INVOICES')
) {
AppToaster.show({
message: intl.get(
'credit_note.error.you_couldn_t_delete_credit_note_that_has_associated_invoice',
),
intent: Intent.DANGER,
});
}
if (
errors.find(
(error) => error.type === 'CREDIT_NOTE_HAS_REFUNDS_TRANSACTIONS',
)
) {
AppToaster.show({
message: intl.get(
'credit_note.error.you_couldn_t_delete_credit_note_that_has_associated_refund',
),
intent: Intent.DANGER,
});
}
};

View File

@@ -99,6 +99,18 @@ export const handleDeleteErrors = (errors) => {
intent: Intent.DANGER,
});
}
if (
errors.find(
(error) => error.type === 'SALE_INVOICE_HAS_APPLIED_TO_CREDIT_NOTES',
)
) {
AppToaster.show({
message: intl.get(
'invoices.error.you_couldn_t_delete_sale_invoice_that_has_reconciled',
),
intent: Intent.DANGER,
});
}
};
export function ActionsMenu({