|
|
|
@ -130,6 +130,12 @@ export const useCreateEditUser = ({
@@ -130,6 +130,12 @@ export const useCreateEditUser = ({
|
|
|
|
|
|
|
|
|
|
const createUser = async (value: IUserForm) => { |
|
|
|
|
try { |
|
|
|
|
if (value.email) { |
|
|
|
|
value.email = value.email.toLowerCase(); |
|
|
|
|
|
|
|
|
|
setValue("email", value.email); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const dataToSave: ICreateUserPayload = _.omit(value, [ |
|
|
|
|
"confirmPassword", |
|
|
|
|
"permissions", |
|
|
|
@ -150,7 +156,6 @@ export const useCreateEditUser = ({
@@ -150,7 +156,6 @@ export const useCreateEditUser = ({
|
|
|
|
|
userId |
|
|
|
|
); |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log("easdasdasasdas", e); |
|
|
|
|
if (isHttpErrorEqual(e, "user_already_exists")) { |
|
|
|
|
const meta = extractMetaFromException(e); |
|
|
|
|
const duplicateFields = meta?.duplicateFields || []; |
|
|
|
@ -180,6 +185,12 @@ export const useCreateEditUser = ({
@@ -180,6 +185,12 @@ export const useCreateEditUser = ({
|
|
|
|
|
|
|
|
|
|
const updateUser = async (value: IUserForm) => { |
|
|
|
|
try { |
|
|
|
|
if (value.email) { |
|
|
|
|
value.email = value.email.toLowerCase(); |
|
|
|
|
|
|
|
|
|
setValue("email", value.email); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const dataToUpdate = _.omitBy( |
|
|
|
|
value, |
|
|
|
|
(it, key) => |
|
|
|
|