axios post vs get code example
Example 1: axios api post request
import qs from 'qs';
const data = { 'bar': 123 };
const options = {
method: 'POST',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
data: qs.stringify(data),
url,
};
axios(options);
Example 2: axios vs request
axios.post('http://pokeapi.co/api/v2/pokemon/', { pokemon: 'Pikachu', }) .then((response) => { return response; }) .catch((error) => { console.log(error); });