Answers for "axios fetch"

1

How to fetch data from an api axios

import axios from "axios"

const fetchData = () => {
return axios.get("https://randomuser.me/api/")
      .then((response) => console.log(response.data));}
Posted by: Guest on June-07-2021
1

axios fetch

axios.get("/path", (res) => {
	res.json(
}).then(data => console.log(data))
Posted by: Guest on May-21-2021
-1

axios response is string how to get resposne headers

// Add a request interceptor
axios.interceptors.request.use(function (config) {
    // Do something before request is sent
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });

// Add a response interceptor
axios.interceptors.response.use(function (response) {
    // Do something with response data
    return response;
  }, function (error) {
    // Do something with response error
    return Promise.reject(error);
  });
Posted by: Guest on July-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language