Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Jesulayomy opened this issue Oct 23, 2024 · 2 comments
Open

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

Jesulayomy opened this issue Oct 23, 2024 · 2 comments
Assignees
Labels
assigned Already assigned to someone, don't work on the same issue enhancement New feature or request feature A new feature, or modifications to an existing one good first issue Good for newcomers hack Hacktoberfest help wanted Extra attention is needed priority Would love to close this issue ASAP

Comments

@Jesulayomy
Copy link
Owner

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.

@Jesulayomy Jesulayomy added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers hack Hacktoberfest priority Would love to close this issue ASAP feature A new feature, or modifications to an existing one labels Oct 23, 2024
@keshav1441
Copy link

i want to contribute to this issue

@Jesulayomy
Copy link
Owner Author

@keshav1441 Granted, please go ahead

@Jesulayomy Jesulayomy added the assigned Already assigned to someone, don't work on the same issue label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned Already assigned to someone, don't work on the same issue enhancement New feature or request feature A new feature, or modifications to an existing one good first issue Good for newcomers hack Hacktoberfest help wanted Extra attention is needed priority Would love to close this issue ASAP
Projects
None yet
Development

No branches or pull requests

2 participants