Browse Source

fix: save user email

stage
Vitalik 3 months ago
parent
commit
782896d1f3
  1. 4
      scripts/push-stage.sh
  2. 4
      src/config/index.ts
  3. 13
      src/containers/User/hooks/use-create-edit-user.hook.ts

4
scripts/push-stage.sh

@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
# npm run build
ssh root@185.69.154.136 "
cd /home/rws/admin &&
cd /var/www/rws/admin &&
rm -R build
"
scp -r ./build root@185.69.154.136:/home/rws/admin/build
scp -r ./build root@185.69.154.136:/var/www/rws/admin/build
ssh root@185.69.154.136 "nginx -s reload"

4
src/config/index.ts

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
import _ from "lodash";
export const config = {
apiUrl: "http://localhost:3000/",
// apiUrl: "http://localhost:3000/",
// apiUrl: "http://185.69.154.136:5000/admin/",
// apiUrl: "http://185.69.154.136:5000/",
// socketUrl: "http://localhost:3000/",
// apiUrl: "https://taskme-api.work-jetup.site/",
apiUrl: "https://taskme-api.work-jetup.site/",
socketUrl: "https://taskme-api.work-jetup.site",
pdfViewer: "https://taskme-pdf-viewer.work-jetup.site",
oneSignalId: "8b9066f5-8c3f-49f7-bef4-c5ab621f9d27",

13
src/containers/User/hooks/use-create-edit-user.hook.ts

@ -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) =>

Loading…
Cancel
Save