Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onLogin () {
- const formData = {
- email: this.email,
- password: this.password,
- returnSecureToken:true
- }
- this.$store.dispatch('login',{
- email: this.email,
- password: this.password,
- }).then(res => {
- console.log("Role is",res);
- //this.$router.push('/'+role)
- this.$router.push('/dataEntry')
- });
- console.log("then here");
- }
- login({commit},authData){
- axios.post('http://localhost/laravel_back/public/api/login',authData
- )
- .then(res => {
- console.log("Back-end Response",res);
- commit('authUser',{
- token:res.data[0].token,
- userName:res.data[1][0].fname,
- id:res.data[2].id,
- type:res.data[3][0].role_id
- })
- let role = res.data[3][0].role_id;
- console.log("Role inside action",role);
- resolve(role)
- })
- .catch(error => console.log(error))
- console.log("FIRST ACTIONS");
- }
Add Comment
Please, Sign In to add comment