mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +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,
|
||||
});
|
||||
}
|
||||
};
|
||||
13
src/containers/Preferences/Users/Roles/utils.js
Normal file
13
src/containers/Preferences/Users/Roles/utils.js
Normal file
@@ -0,0 +1,13 @@
|
||||
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 === 'ROLE_PREFINED')) {
|
||||
AppToaster.show({
|
||||
message: intl.get('roles.error.role_is_predefined'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user