Skip to content

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

@Jesulayomy

Description

@Jesulayomy

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.

Metadata

Metadata

Assignees

Labels

assignedAlready assigned to someone, don't work on the same issueenhancementNew feature or requestfeatureA new feature, or modifications to an existing onegood first issueGood for newcomershackHacktoberfesthelp wantedExtra attention is neededpriorityWould love to close this issue ASAP

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions