added mocked fetch newest timetable
This commit is contained in:
parent
157dc2f35e
commit
c16561cfd1
@ -86,15 +86,33 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
const getNewestTimetable = async () => {
|
||||||
const fetchData = async () => {
|
//todo
|
||||||
|
try {
|
||||||
|
const { data: basket } = await axios.get(
|
||||||
|
`${process.env.REACT_APP_API_URL}/api/v1/assignments/getCurrentAssignments`,
|
||||||
|
);
|
||||||
|
// setBasket(basket);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchClasses = async () => {
|
||||||
|
try {
|
||||||
const { data: courses } = await axios.get<Array<Course>>(
|
const { data: courses } = await axios.get<Array<Course>>(
|
||||||
`${process.env.REACT_APP_API_URL}/api/v1/courses/getCoursesWithGroups`,
|
`${process.env.REACT_APP_API_URL}/api/v1/courses/getCoursesWithGroups`,
|
||||||
);
|
);
|
||||||
courses.sort((a, b) => (a.name > b.name ? 1 : -1));
|
courses.sort((a, b) => (a.name > b.name ? 1 : -1));
|
||||||
setCourses(courses);
|
setCourses(courses);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
fetchData();
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchClasses();
|
||||||
|
getNewestTimetable();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user