1
Hello, I want to pass parameters in redirect the same way I do in render method, I need it redirect because I do not want to render a page but redirect to the API route that is already rendering the page with the data I need.
It has how I pass a parameter in res.redirect to then check on the front end if it exists and print the message in which I pass as parameter the idea would be similar what this below has some way to do this.
Aluno.findAndCount({ where: { AL_TURMA: id } }).then((alunos) => {
if (alunos.count === 0) {
Turma.destroy({ where: { TR_ID: id } })
res.status(200).redirect('/turmas', /*msg: sucesso*/);
} else {
res.status(200).redirect('/turmas', /*{ msg: 'Existem alunos nesta turma. Não é possivel excluir' }*/)
}
})
Is there any way to do this ?