Description
Refactoring: Centralized Fetcher System with Axios
Acceptance Criteria
[ ] Centralize all API calls in dedicated services
[ ] Use Axios with interceptors to handle authentication automatically
[ ] Implement consistent HTTP error handling
[ ] Improve 401 error redirection (React Router instead of window.location.href)
[ ] Significantly reduce code duplication
[ ] Facilitate testing and future maintenance
Additional Context
Currently, API calls in the project use fetch scattered across multiple components, with a lot of duplicated code for:
- Authentication management (adding tokens)
- URL construction
- Handling 401 errors
- localStorage cleanup
This duplication makes the code difficult to maintain and increases the risk of errors.
Description
Refactoring: Centralized Fetcher System with Axios
Acceptance Criteria
[ ] Centralize all API calls in dedicated services
[ ] Use Axios with interceptors to handle authentication automatically
[ ] Implement consistent HTTP error handling
[ ] Improve 401 error redirection (React Router instead of window.location.href)
[ ] Significantly reduce code duplication
[ ] Facilitate testing and future maintenance
Additional Context
Currently, API calls in the project use fetch scattered across multiple components, with a lot of duplicated code for:
This duplication makes the code difficult to maintain and increases the risk of errors.