Question: Create a axios post request to access a given API. I have the following code so far but I get a 404 Error. class Cards
Create a axios post request to access a given API. I have the following code so far but I get a 404 Error.
class Cards extends Component { state = { games: [] } componentDidMount() { var proxyUrl = 'https://cors-anywhere.herokuapp.com/'; let token ='****************************' axios.defaults.headers.common['Authorization'] = token; axios.defaults.headers.common['Context-Type'] = 'application/json'; axios.defaults.headers.common['Accept'] = 'application/json'; axios.defaults.headers.common['Client_ID'] = 'codnvs49gx7ivbo5877zm1bv595q49'; axios.post({ url: proxyUrl + "api.igdb.com/v4/games", data: "fields age_ratings,aggregated_rating,aggregated_rating_count" }).then(response => { console.log(response.data); this.setState({ games: response.data }) }).catch(err => { console.error(err); }); } render() { return () } }; export default Cards; Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
