N
N
Nurseit Sharip2018-12-25 14:02:22
Vue.js
Nurseit Sharip, 2018-12-25 14:02:22

Axios makes GET request infinite times, how to fix it?

Good afternoon. There was a problem with Axios. I make a GET request and the server responds infinitely or requests from the client infinite times.
I make a POST request like this

auth_request: function() {
      Axios.post("http://192.168.1.116:8000/api/test/", {
        login: this.name,
        password: this.password
      })
        .then(response => {
          const token = response.data;
          console.log("auth_request отправил данные");
          localStorage.setItem("token", response.data.message);
          document.cookie = name = response.data.message;
          console.log(document.cookie);
          this.$router.replace(this.$route.query.redirect || "/tamam");
        })
        .catch(function(err) {
          console.log("q");
        });
    }

It sends the form to the server, and in the submit button
<v-btn :disabled="step === 3" depressed flat small type="submit" @click="getData">Войти</v-btn>

I call the GET function
getData({ dispatch }) {
      return new Promise((resolve, reject) => {
        Axios({ url: "test/", method: "GET" })
          .then(resp => {
            dispatch("getData");
            resolve(resp);
          })
          .catch(err => {
            reject(err);
            console.log("error in store");
          });
      });
    }

after that GET happens infinite times.
5c220c839c632413789285.png
How can I fix it? What is it connected with?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question