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));}
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));}
axios fetch
axios.get("/path", (res) => {
res.json(
}).then(data => console.log(data))
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);
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us