0

I'm trying to login user. When I send correct data

Vue.axios.post(context.state.userAuthLinks.login, {
     email: playload.email,
     password: playload.password
})

it works fine, but when I try to post wrong data, vue app reload with

http://localhost:8080/?email=asd%40gmail.com&password=asdasdasd#/

also, I found stange thing. When I, for example, sing up new user with the same email, to get error, app does not reload... It happens not only with dev server. On product server the same error.

full method

loginUser(context, playload) {
    return new Promise((loginResolve, loginReject) => {
        Vue.axios.post(context.state.userAuthLinks.login, {
            email: playload.email,
            password: playload.password
        }).then(function(res) {
            loginResolve(res);
            context.commit('setUserId', res.data.userId);
            context.commit('setUserToken', res.data.id);
            context.commit('setUserAuthenticated', true);
        }).catch(function(error) {
            // here it don't stops with 'debugger'
            console.log(error);
            loginReject(error);
        });
    });
},

Also, I have theese headers

 Vue.axios.defaults.baseURL = 'http://localhost:3000';
 Vue.axios.defaults.headers.common['Content-Type'] = 'application/x-www-form-urlencoded';
Triple -B
  • 261
  • 2
  • 12

0 Answers0