Skip to content

Commit

Permalink
edit user
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnypaulino committed Jul 22, 2024
1 parent e1c7b74 commit 55c5efc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Context/Users/state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export const UsersState = () => {
project: GetId(data.project),
sex: data.sex,
color_race: data.color_race,
birthday: data.birthday,
birthday: converterData(data.birthday),
email: data.email,
initial_date: data.initial_date,
initial_date: converterData(data.initial_date),
phone: data.phone,
};
props.requestUserMutation.mutate(body);
Expand Down
2 changes: 1 addition & 1 deletion src/Context/Users/type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface CreateUser {
username: string;
password?: string;
project: number[];
role?: { name: string, id: string }
role?:string,
email?: string,
phone?: string,
sex: number,
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Users/CreateUser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const CreateUserPage = () => {
name: Yup.string().required("Campo Obrigatório").min(8, "Nome deve ter pelo menos 8 caracteres"),
username: Yup.string().required("Campo Obrigatório").min(8, "Nome do usuário deve ter pelo menos 8 caracteres"),
password: Yup.string().required("Campo Obrigatório").min(8, "Senha deve ter pelo menos 8 caracteres"),
role: Yup.object().required("Campo Obrigatório"),
role: Yup.string().required("Campo Obrigatório"),
project: Yup.array().required("Campo Obrigatório"),
initial_date: Yup.string().required("Campo Obrigatório"),
birthday: Yup.string().required("Campo Obrigatório"),
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/Users/EditUser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ const EditUserPage = () => {
username: project?.username ?? "",
role: project?.role ?? "",
project: selectTs(project.user_social_technology),
initial_date: formatarData(project?.reapplicators[0]?.initial_date) ?? "",
initial_date: project?.reapplicators[0]?.initial_date ? formatarData(project?.reapplicators[0]?.initial_date) : "",
phone: project?.reapplicators[0]?.phone ?? "",
email: project?.reapplicators[0]?.email ?? "",
color_race: project?.reapplicators[0]?.color_race ?? "",
sex: project?.reapplicators[0]?.sex ?? "",
birthday: formatarData(project?.reapplicators[0]?.birthday) ?? "",
birthday: project?.reapplicators[0]?.birthday ? formatarData(project?.reapplicators[0]?.birthday) : "",
}}
onSubmit={(values) => {
props.UpdateUser(values, parseInt(id!));
Expand Down
3 changes: 2 additions & 1 deletion src/Services/Users/request.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ export const requestUsersChart = (id?: string) => {
export const requestCreateUsers = (data: CreateUser) => {
let path = "/user-bff";

console.log(data)
return http
.post(path, { ...data, role: data.role?.id })
.post(path, { ...data, role: data.role })
.then((response) => response.data)
.catch((err) => {
if (err.response.status === 401) {
Expand Down

0 comments on commit 55c5efc

Please sign in to comment.