Mongo (Cloud) + Vue.js - Is it right or wrong?

Asked

Viewed 31 times

0

Hello,

I am programming an application using Vue.JS, (I am new to Javascript) and Mongo (Cloud Server) and I wanted to ask a question to know if my logic is correct or wrong, and if I need to improve...

When the user logs in, I save the user data by localStorage, thus:

    methods() {
     let api = 'localhost:3000/api/login';
      axios.post(api, {
       email: email,
       password: password
     })
      .then((res) => {
       var useruid = res.uid;
       localStorage.setItem('logado', useruid);
       this.$router.push('/dashboard');
      });
}

That’s how I programmed my app. That’s right my code?

  • Right in what way? I see no point in using get for login, how the server will know which user credentials?

  • It’s post, I ended up adding get in wrong place. I edited the post if you can answer thank you. Abç

  • To save in localstorage after login is right, you need to configure later the logoff, also validate if the person is actually logged in to the backend not to see the system screen even the server sending a 403

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.