This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
React -> Api error :) #105
Unanswered
chandra999999
asked this question in
Q&A
Replies: 1 comment
-
Hi @chandra999999 I am missing some context here. You have asked this question in the Live Map repo, but it appears this question is not related. Let me know if this was posted by mistake. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey can anyone help me with this:)
Uncaught (in promise)
Object { message: “Request failed with status code 404”, name: “AxiosError”, code: “ERR_BAD_REQUEST”, config: {…}, request: XMLHttpRequest, response: {…}, stack: “” }
code: "ERR_BAD_REQUEST"
config: Object { timeout: 0, xsrfCookieName: “XSRF-TOKEN”, xsrfHeaderName: “X-XSRF-TOKEN”, … }
message: "Request failed with status code 404"
name: “AxiosError”.
can anyone help me fixing this 😃
useEffect(() => {
const response=fetchfromApi(‘search?part=snippet&q=${selectedCategory}’)
console.log(response);
}, [selectedCategory]);
I’m not getting a promise back 😃)
the following is in other file
import axios from 'axios';
const BASE='https://youtube-v31.p.rapidapi.com';
const options = {
params: {
maxResults: ‘50’,
},
headers: {
‘X-RapidAPI-Key’: process.env.REACT_APP_RAPID_API_KEY,
‘X-RapidAPI-Host’: ‘youtube-v31.p.rapidapi.com’
}
};
export const fetchfromApi=async(url)=>{
const {data}=await axios.get(’BASE/BASE/{url}’,options)
console.log(data)
return data;
}
// const {data} = await axios.get('${BASE}/${url}',options) pls consider this in the place of that one in function fecthfromApi
Beta Was this translation helpful? Give feedback.
All reactions