Skip to content

Commit

Permalink
Fix error on authMixins
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorCarvalho67 committed Jun 9, 2024
1 parent 1c094c6 commit 899b7de
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/src/util/authMixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const mixinAdmin = {
try {
const response = await refreshTokenAdmin(this.admin.token);
if (response.status >= 200 && response.status < 300) {
Cookies.set('token', `${response.data.token}`);
Cookies.set('token-admin', `${response.data.token}`);
}
} catch (error) {
router.push({ path: '/admin/login' });
Expand Down
5 changes: 2 additions & 3 deletions client/src/views/admin/RegisterCoordenador.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default {
},
data() {
return {
token: '',
coordenador: {
name: '',
},
Expand All @@ -46,7 +45,7 @@ export default {
methods: {
async submitForm() {
try {
const response = await registerCoordenador(this.coordenador.name, this.token);
const response = await registerCoordenador(this.coordenador.name, this.admin.token);
if (response.status >= 200 && response.status < 300) {
alert("Tudo certo! 😉");
Expand All @@ -60,7 +59,7 @@ export default {
},
async GetProfessores() {
try {
const response = await getProfessores(this.token);
const response = await getProfessores(this.admin.token);
this.professores = response.data
} catch (error) {
alert("Ops.. Algo deu errado. 😕\n" + error.message);
Expand Down
5 changes: 2 additions & 3 deletions client/src/views/admin/RegisterCurso.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export default {
},
data() {
return {
token: '',
curso: {
name: '',
turno: '',
Expand All @@ -83,7 +82,7 @@ export default {
duracao: (this.curso.duracao_quantidade + " " + this.curso.duracao_periodo),
coordenador: this.curso.coordenador
},
this.token
this.admin.token
);
if (response.status >= 200 && response.status < 300) {
Expand All @@ -97,7 +96,7 @@ export default {
},
async GetCoordenadores() {
try {
const response = await getCoordenadores(this.token);
const response = await getCoordenadores(this.admin.token);
this.coordenadores = response.data;
} catch (error) {
alert("Ops.. Algo deu errado. 😕\n" + error.message);
Expand Down
3 changes: 1 addition & 2 deletions client/src/views/admin/RegisterFuncionario.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export default {
},
data() {
return {
token: '',
funcionario: {
name: '',
tituloPrincipal: '',
Expand Down Expand Up @@ -80,7 +79,7 @@ export default {
email: this.funcionario.email,
cargo: this.funcionario.cargo
},
this.token
this.admin.token
);
Expand Down
3 changes: 1 addition & 2 deletions client/src/views/admin/RegisterProfessor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default {
},
data() {
return {
token: '',
professor: {
name: '',
tituloPrincipal: '',
Expand All @@ -58,7 +57,7 @@ export default {
tituloPrincipal: this.professor.tituloPrincipal,
email: this.professor.email
},
this.token
this.admin.token
);
if (response.status >= 200 && response.status < 300) {
Expand Down
5 changes: 2 additions & 3 deletions client/src/views/admin/RegisterTurma.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default {
},
data() {
return {
token: '',
turma: {
inicio: '',
fim: '',
Expand Down Expand Up @@ -72,7 +71,7 @@ export default {
fim: this.turma.fim,
cursoName: this.turma.curso
},
this.token
this.admin.token
);
if (response.status >= 200 && response.status < 300) {
Expand All @@ -87,7 +86,7 @@ export default {
async GetCursos() {
try {
const response = await getCursos(this.token);
const response = await getCursos(this.admin.token);
this.cursos = response.data
} catch (error) {
alert("Ops.. Algo deu errado. 😕\n" + error.message);
Expand Down
2 changes: 1 addition & 1 deletion server/src/middleware/auth/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function validateTokenAluno(token: string){
throw new Error('Aluno not found');
}

return aluno;
return "validate Token Aluno";
} catch (error) {
throw new Error('Token inválido: ' + error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export class RegisterCoordenadorUseCase {
}
});

console.log("Break point ⭕");

if (!coordenadorRegister) {
throw new AppError("Erro ao cadastrar professor!");
} else {
Expand Down

0 comments on commit 899b7de

Please sign in to comment.