Download Movix/src/utils/api.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 474 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Movix/src/utils/api.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Movix/src/utils/api.js
-
curl -L -o api.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Movix/src/utils/api.js
474 Bytes
| import axios from "axios"; | |
| const BASE_URL = "https://api.themoviedb.org/3"; | |
| const TMDB_TOKEN = import.meta.env.VITE_APP_TMDB_TOKEN; | |
| const headers = { | |
| Authorization: "bearer " + TMDB_TOKEN, | |
| }; | |
| export const fetchDataFromApi = async (url, params) => { | |
| try { | |
| const { data } = await axios.get(BASE_URL + url, { | |
| headers, | |
| params, | |
| }); | |
| return data; | |
| } catch (err) { | |
| console.log(err); | |
| return err; | |
| } | |
| }; | |