Skip to content

refactor: centralize feature API calls#297

Merged
stasel merged 6 commits intoHackYourFuture:mainfrom
Hadley99:task/issue-287-centralize-api-calls
Feb 9, 2026
Merged

refactor: centralize feature API calls#297
stasel merged 6 commits intoHackYourFuture:mainfrom
Hadley99:task/issue-287-centralize-api-calls

Conversation

@Hadley99
Copy link
Contributor

@Hadley99 Hadley99 commented Feb 7, 2026

  • Move cohorts, dashboard, search and trainee-profile HTTP calls into feature api/api.ts modules
  • Update React Query hooks to consume typed API helpers
  • Extract shared search response and trainee save request types

Refs: #287

- Move cohorts, dashboard, search and trainee-profile HTTP calls into feature api/api.ts modules
- Update React Query hooks to consume typed API helpers
- Extract shared search response and trainee save request types

Refs:  HackYourFuture#287
@Hadley99 Hadley99 marked this pull request as ready for review February 7, 2026 07:26
Copilot AI review requested due to automatic review settings February 7, 2026 07:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements issue #287 by centralizing previously inline HTTP requests into feature-scoped api/api.ts modules and updating React Query hooks to call these typed API helpers.

Changes:

  • Added per-feature api/api.ts modules for cohorts, dashboard, search, and trainee-profile subfeatures (personal info, interactions, tests, strikes).
  • Updated React Query hooks to use the new API helper functions instead of inline axios calls.
  • Extracted shared request/response types (e.g., SearchResultResponse, SaveTraineeRequestData) into dedicated type definitions.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
client/src/features/trainee-profile/personal-info/data/useTraineeInfoData.tsx Refactors hooks to call getTraineeInfo/saveTraineeInfo and imports shared request type.
client/src/features/trainee-profile/personal-info/api/types.ts Introduces SaveTraineeRequestData type for trainee profile saves.
client/src/features/trainee-profile/personal-info/api/api.ts Adds typed API helpers for trainee info fetch/save.
client/src/features/trainee-profile/interactions/data/interaction-queries.ts Updates interaction hooks to use centralized API helpers.
client/src/features/trainee-profile/interactions/api/api.ts Adds interaction API helper functions and error handling.
client/src/features/trainee-profile/education/tests/data/test-queries.ts Updates test hooks to use centralized API helpers.
client/src/features/trainee-profile/education/tests/api/api.ts Adds tests API helper functions and error handling.
client/src/features/trainee-profile/education/strikes/data/strike-queries.ts Updates strike hooks to use centralized API helpers.
client/src/features/trainee-profile/education/strikes/api/api.ts Adds strikes API helper functions and error handling.
client/src/features/search/data/queries.ts Refactors search query hook to use getSearchResults.
client/src/features/search/api/api.ts Adds search API helper function.
client/src/features/search/Search.ts Extracts SearchResultResponse type alongside SearchResult.
client/src/features/dashboard/data/useDashboardData.tsx Refactors dashboard query hook to use getDashboardData.
client/src/features/dashboard/api/api.ts Adds dashboard API helper function.
client/src/features/cohorts/data/useCohortsData.tsx Refactors cohorts query hook to use getCohorts.
client/src/features/cohorts/api/api.ts Adds cohorts API helper function.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HackYourFutures HackYourFutures temporarily deployed to dojo-task-issue-287-cen-ttnydm February 7, 2026 19:28 Inactive
Copy link
Contributor

@zalexa19 zalexa19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear Hadely,
The changes look good!
Thank you for your contribution :)

@HackYourFutures HackYourFutures temporarily deployed to dojo-task-issue-287-cen-ttnydm February 8, 2026 01:36 Inactive
Copy link
Member

@stasel stasel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Can you please resolve all the comments? I will merge the PR after everything is resolved

@Hadley99
Copy link
Contributor Author

Hadley99 commented Feb 9, 2026

Looks good. Can you please resolve all the comments? I will merge the PR after everything is resolved

@stasel , I've resolved all the comments.

@stasel stasel merged commit d304d4a into HackYourFuture:main Feb 9, 2026
1 check passed
@stasel
Copy link
Member

stasel commented Feb 9, 2026

Thank you for your contribution

MBreathe pushed a commit to MBreathe/dojo that referenced this pull request Feb 11, 2026
* refactor: centralize feature API calls

- Move cohorts, dashboard, search and trainee-profile HTTP calls into feature api/api.ts modules
- Update React Query hooks to consume typed API helpers
- Extract shared search response and trainee save request types

Refs:  HackYourFuture#287

* Improved error handling

* Removed try/catch to preserve 401 redirect functionality

* improved parameter handling

* refactor: streamline API response handling in trainee info functions

* fixed params for axios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants