refactor(sh-admin): improved error handling and dynamic user actions in admin dashboard (#4044)
* feat: new helper functions for better error management * refactor: new i18n strings * refactor: better error handling in invite modal and members component * refactor: better user management * refactor: better error handling in config handler * refactor: updated logic of dynamic action row * refactor: better naming for computed properties * feat: new error message when an admin tries to invite himself * refactor: updated error message when user is already invited * refactor: reverted i18n string for user already invited back to the old string * refactor: removed show prop from invite modal * refactor: improved implementation for getting the compiled error messages * feat: new error message when email inputted is of an invalid format * refactor: minor optimization --------- Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
This commit is contained in:
committed by
GitHub
parent
5fd7c28894
commit
5805826994
@@ -27,6 +27,7 @@ import {
|
||||
ServerConfigs,
|
||||
UpdatedConfigs,
|
||||
} from '~/helpers/configs';
|
||||
import { getCompiledErrorMessage } from '~/helpers/errors';
|
||||
import { useToast } from './toast';
|
||||
import { useClientHandler } from './useClientHandler';
|
||||
|
||||
@@ -201,7 +202,12 @@ export function useConfigHandler(updatedConfigs?: ServerConfigs) {
|
||||
const result = await mutation.executeMutation(variables);
|
||||
|
||||
if (result.error) {
|
||||
toast.error(t(errorMessage));
|
||||
const { message } = result.error;
|
||||
const compiledErrorMessage = getCompiledErrorMessage(message);
|
||||
|
||||
compiledErrorMessage
|
||||
? toast.error(t(compiledErrorMessage))
|
||||
: toast.error(t(errorMessage));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user