mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
refactor: vendors alerts.
This commit is contained in:
16
client/src/containers/Vendors/utils.js
Normal file
16
client/src/containers/Vendors/utils.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useCallback } from 'react';
|
||||
import { formatMessage } from 'services/intl';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { AppToaster } from 'components';
|
||||
|
||||
// Transform API errors in toasts messages.
|
||||
export const transformErrors = useCallback((errors) => {
|
||||
if (errors.some((e) => e.type === 'VENDOR.HAS.BILLS')) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: 'vendor_has_bills',
|
||||
}),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
Reference in New Issue
Block a user