axios searchparams code example
Example 1: AXIOS CDN
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
Example 2: axios post
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Example 3: axios instance
const getUser = axios.create({
baseURL: 'https://randomuser.me/api/',
timeout: 1000,
headers: {'X-Custom-Header': 'foobar'}
});
getUser().then(response => console.log(response))