File size: 496 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import axios from "axios";
const base_url = "https://youtube-v31.p.rapidapi.com";
export const options = {
params: {
maxResults: "51",
},
headers: {
"X-RapidAPI-Key": process.env.REACT_APP_SECRET_KEY,
"X-RapidAPI-Host": "youtube-v31.p.rapidapi.com",
},
};
const fetchApi = async (url) => {
try {
const { data } = await axios.get(`${base_url}/${url}`, options);
return data;
} catch (error) {
console.log("error in fetch api");
}
};
export default fetchApi;
|