A
A
Aleksandr2018-04-17 12:28:59
Vue.js
Aleksandr, 2018-04-17 12:28:59

Passing parameters in get request in vue js?

I actually do the filtering, when you click on apply the filter, the request flies to the API
php developer, says that the request should be get, not post
How to pass parameters to the get request?

export const filterDate = (options) => {
    console.log(options)
    return axios.post(url, options).then(({ data }) => {
        if (data.errors) throw new Error(JSON.stringify(data.errors));
        return data;
    })
};

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Koch, 2018-04-17
@Sashjkeee

https://github.com/axios/axios CTRL + F "get"

// Make a request for a user with a given ID
axios.get('/user?ID=12345')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

axios.get('/user', {
    params: {
      ID: 12345
    }
  })

M
Maxim Barabanov, 2018-04-17
@reb00ter

obviously
axios.get

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question