Hi so Im trying to pull data from https://opentimetable.dcu.ie/ based on the course code so like CASE3, so im trying to pull the weeks timetable, but im new to axios and my post request is failing because of the headers i believe and im not sure why I thought i was doing it correct? im basically trying to get the course identity in the api in the post request below
import React, { useState, useEffect } from 'react';
import { View, Text } from 'react-native';
import axios from 'axios';
export default function LoginScreen() {
const [user, setUser] = useState({});
const Query = 'CASE3';
useEffect(() => {
async function loadAPI() {
const response = await axios.post(`https://opentimetable.dcu.ie/broker/api/CategoryTypes/241e4d36-60e0-49f8-b27e-99416745d98d/Categories/Filter?pageNumber=1&query=${Query}`,{headers:{
"Authorization": "basic T64Mdy7m[",
"Content-Type" : "application/json; charset=utf-8",
"credentials": "include",
"Referer" : "https://opentimetable.dcu.ie/",
"Origin" : "https://opentimetable.dcu.ie/"}
});
setUser(response.data);
}
loadAPI();
}, []);
return (
<View style={{ alignItems: "center", marginTop: 24 }}>
<Text>
{user.bio}
</Text>
</View>
);
}