ghost
ghost copied to clipboard
Separate API calls into dedicated files
User Story: Separate API calls into dedicated files
Parent Feature
- https://github.com/oslabs-beta/ghost/issues/62
Description
As a frontend developer, Given that our React application’s codebase has grown and contains API calls within component files, I want to refactor the application to separate API calls into their own dedicated files, So that we can achieve better separation of concerns, enhance code maintainability, and make it easier to manage and test our API interactions.
Acceptance Criteria
- All API calls within React components are identified and listed.
- Dedicated files for API calls are created, following a consistent naming and structuring convention.
- The API call functions are moved to the new files and exported for use in the React components.
- The React components are updated to import and use the API call functions from the new dedicated files.
- Existing functionality is tested to ensure that it works as expected after the refactor.
- Unit tests are updated or created as necessary to cover the separated API call functions.
- Documentation is updated to reflect the new structure and to provide guidelines on how to add new API calls.
Definition of Done
- All acceptance criteria are met.
- All existing functionality works as expected post-refactor.
- Code review is completed, and all feedback is addressed.
- Documentation is complete and reviewed.
- Unit tests are written, and all tests pass.
consider maybe refactoring to use react query?