feat(warehouse & Branch): handle error.

This commit is contained in:
elforjani13
2022-03-07 21:53:54 +02:00
parent a8311f1798
commit e03dee2a9f
6 changed files with 46 additions and 6 deletions

View File

@@ -0,0 +1,15 @@
import intl from 'react-intl-universal';
import { Intent } from '@blueprintjs/core';
import { AppToaster } from 'components';
/**
* Handle delete errors.
*/
export const handleDeleteErrors = (errors) => {
if (errors.find((error) => error.type === 'COULD_NOT_DELETE_ONLY_BRANCH')) {
AppToaster.show({
message: intl.get('branch.error.could_not_delete_only_branch'),
intent: Intent.DANGER,
});
}
};

View File

@@ -0,0 +1,17 @@
import intl from 'react-intl-universal';
import { Intent } from '@blueprintjs/core';
import { AppToaster } from 'components';
/**
* Handle delete errors.
*/
export const handleDeleteErrors = (errors) => {
if (
errors.find((error) => error.type === 'COULD_NOT_DELETE_ONLY_WAERHOUSE')
) {
AppToaster.show({
message: intl.get('warehouse.error.could_not_delete_only_waerhouse'),
intent: Intent.DANGER,
});
}
};