Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#196 fix create user bug #79

Merged
merged 2 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Pages/CreateUser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const ViewProfile = () => {
/>
</div>
<div>
<h1>"Departamento"</h1>
<h1>Departamento</h1>
<select
required
onChange={(event) =>
Expand Down
21 changes: 6 additions & 15 deletions src/Services/Axios/profileService.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ export async function registerUser(usr, toast) {
try {
const user = await validateUser(usr);

if (user.departmentID <= 7) {
// user is a common user
user.departmentID = 0;
}

await APIProfile.post(
"/register",
{
Expand Down Expand Up @@ -204,9 +199,8 @@ export async function getDepartments() {
try {
const response = await APIProfile.get("/departments");
return response.data;
} catch (error) {
console.error(`failed to get departments: ${error}`);
return error;
} catch (err) {
console.error(`failed to get departments: ${err}`);
}
}

Expand All @@ -217,7 +211,6 @@ export async function getDepartmentsTotalNumber(toast) {
return response.data;
} catch (error) {
toast.error("Erro ao buscar o total de Departamentos!");
return error;
}
}

Expand All @@ -226,9 +219,8 @@ export async function getSections() {
try {
const response = await APIProfile.get("/sections");
return response.data;
} catch (error) {
console.error(`failed to get sections: ${error}`);
return error;
} catch (err) {
console.error(`failed to get sections: ${err}`);
}
}

Expand All @@ -240,7 +232,8 @@ export async function getDepartmentsByPage(toast) {
return response.data;
} catch (error) {
toast.error("Erro ao buscar departamento!");
return error;

console.log(error);
}
}

Expand All @@ -257,7 +250,6 @@ export async function registerDepartment(name, toast) {
return response.data;
} catch (error) {
toast.error("Não foi possível cadastrar o departamento!");
return error;
}
}

Expand All @@ -274,6 +266,5 @@ export async function registerSection(name, toast) {
return response.data;
} catch (error) {
toast.error("Não foi possível cadastrar o departamento!");
return error;
}
}