Jesulayomy / SCHub

SCHub v0.1, A school data management system to allow School administration, Teachers manage students and courses data.
https://schub.jesulayomi.tech
MIT License
3 stars 10 forks source link

[Feature] [Migration]: Abstract react axios calls #34

Open Jesulayomy opened 4 weeks ago

Jesulayomy commented 4 weeks ago

React calls are being made in place using direct http links. This can be moved to a separate module and then call paths where needed.

axios
  .get('http://localhost:5000/api/courses', { withCredentials: true })
  .then((res) => {
    setAllCourses(res.data);
    setCourses(res.data);
  })
  .catch((err) => {
    console.log('Error:', err);
  });
import {axiosHandler} from 'contexts/axios'
axiosHandler
  .get('api/courses', { withCredentials: true })
  .then((res) => {
    setAllCourses(res.data);
    setCourses(res.data);
  })
  .catch((err) => {
    console.log('Error:', err);
  });

Response data also needs to be formatted to use new Django responses.

keshav1441 commented 4 weeks ago

i want to contribute to this issue

Jesulayomy commented 4 weeks ago

@keshav1441 Granted, please go ahead