Skip to content

Commit

Permalink
fix: 🐛 fixes error that blocked users from being registered fga-eps-m…
Browse files Browse the repository at this point in the history
…ds/2021.1-Oraculo#130

Co-authored-by: Joao Paulo Lima da Silva <[email protected]>
  • Loading branch information
lucasvmx and jpaulohe4rt committed Oct 28, 2021
1 parent 4040ddc commit 9b73b45
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Services/Axios/profileService.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ export async function registerUser(usr, toast) {
try {
const user = await validateUser(usr);

if (user.departmentID <= 7) {
// user belongs to a admin sector
user.sectionID = 0;
} else {
// user is a common user
user.departmentID = 0;
}

await APIProfile.post(
"/register",
{
Expand All @@ -62,13 +70,9 @@ export async function registerUser(usr, toast) {
const status = err.response?.status;

if (status === 401) {
toast.error(
"Você não possui privilégios suficientes para realizar esta ação"
);
toast.error("Você não possui privilégios suficientes para realizar esta ação");
} else if (status === 400) {
toast.error(
"Faltam algumas informações para realizar o cadastro do usuário"
);
toast.error("Faltam algumas informações para realizar o cadastro do usuário");
} else {
toast.error(`Erro ao cadastrar usuário!`);
}
Expand Down Expand Up @@ -117,9 +121,7 @@ export async function listAllUsers(toast) {
const status = err.response?.status;

if (status === 401) {
toast.error(
"Você não possui privilégios suficientes para realizar esta ação"
);
toast.error("Você não possui privilégios suficientes para realizar esta ação");
}
}
}
Expand Down

0 comments on commit 9b73b45

Please sign in to comment.