Download Youtube-Clone/src/utils/Fetch.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 496 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Youtube-Clone/src/utils/Fetch.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Youtube-Clone/src/utils/Fetch.js
-
curl -L -o Fetch.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Youtube-Clone/src/utils/Fetch.js
496 Bytes
| 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; | |