mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat: handle errors.
This commit is contained in:
15
src/containers/Dialogs/UserFormDialog/utils.js
Normal file
15
src/containers/Dialogs/UserFormDialog/utils.js
Normal 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 transformErrors = (errors) => {
|
||||
if (
|
||||
errors.find((error) => error.type === 'CANNOT_AUTHORIZED_USER_MUTATE_ROLE')
|
||||
) {
|
||||
AppToaster.show({
|
||||
message: intl.get('roles.error.you_cannot_change_your_own_role'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user