1
I have an application that the front end is Vuejs/Quasar and the server is hapiJS. I am working on the login part and would like to know how to redirect the page after receiving confirmation from the server that the data entered in the login is correct.
Server:
server.route({
path: '/login',
method: 'post',
handler: function (request, reply) {
let user = request.query.login;
let pass = request.query.senha;
let pesquisa = {'usuario': {$eq: user}, 'senha': {$eq: pass}};
db.open(function (err, mongoclient) {
mongoclient.collection('login', function (err, collection) {
collection.find(pesquisa).toArray(function (err, results) {
if (err) {
console.log(err);
mongoclient.close()
} else {
if (results === pesquisa) {
console.log('Login correto');
mongoclient.close();
}
}
})
})
})
}
});
Client:
entrar () {
let self = this
axios({
url: '/server/login',
method: 'post',
params: self.pessoa
})
.then(function (response) {
console.log(response.data)
this.$route.router.go(response.data)
})
.catch(function (error) {
console.log(error)
})
}
What should I send on server replay to the client??? How to redirect the page to the client after receiving the data from the server??
See if this helps you. link
– Sérginho
Help yes, thank you very much
– LeonardoEbert