N
N
Nurseit Sharip2018-12-25 07:59:33
Vue.js
Nurseit Sharip, 2018-12-25 07:59:33

How to make a POST request with Axios?

How to make a POST request with Axios.

methods: {
      clear () {
        this.$refs.login.reset()
      },
      logIn: function () {
        Axios.post('http://192.168.1.116:8000', {
          login: this.name,
          password: this.password
        })
          .then(()=>{
            console.log('qqwe')
            this.$router.replace(this.$route.query.redirect || '/tamam')
          })
          .catch(function (err) {
            console.log('q')
          })
      },
    }

There is such a script. Is it right? The server shows empty values.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sklyarov, 2018-12-25
@NurseitSharip

Because you are not accepting a response from the server:

.then((response)=>{
     console.log(response.data);
     this.$router.replace(this.$route.query.redirect || '/tamam')
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question