0

I have a form which related on v-model. So, it is default login page. When I try to log in I got unautorized 401, but in Postman I got the token with same credentials.

export default {
    data() {
        return {
            email: '',
            password: '',
            output: ''
        };
    },
    methods: {
        login() {
            axios.post('api/login', {
                email: this.email,
                password: this.password },
                { headers: {
                        'Content-type': 'application/x-www-form-urlencoded',
                    }
                }).then(response => {
                    this.output = response.data;
            });
        }
    }
}
Danabek Duisekov
  • 315
  • 5
  • 12

1 Answers1

0

This worked

axios.post('api/login/',
    {
        email: this.email,
        password: this.password
    }
Danabek Duisekov
  • 315
  • 5
  • 12