Re-factoring API services #14
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes significant refactoring and improvements to the codebase, focusing on updating API endpoints, improving error handling, and enhancing test coverage. The most important changes include the removal of deprecated API calls, the introduction of a new error handling mechanism, and the refactoring of service classes to use updated endpoints.
API Refactoring:
src/api/index.ts
and updated the corresponding service classes to use new endpoints. ([[1]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-764761d79ed791ea154187526b088322dba3bebe94f9d38ab22120554aba77c7L1-L28)
,[[2]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-9dd13b51c673219aa9d6fb02c8bc1100134172df11c9c69008b0b299c0b3d53fR28-R39)
,[[3]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-9dd13b51c673219aa9d6fb02c8bc1100134172df11c9c69008b0b299c0b3d53fL47-R58)
,[[4]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-cd77df0f49406951d1fac5878b9dbaedda26efdcfdf299051c8efa5b820c22fcL10-R10)
,[[5]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-ebf1d939d609a4816004caf5632789818db419201d7af8b12e6123dcfd0b995dL6-R10)
)Error Handling:
useCallback
inChatContainer.tsx
to centralize error notifications. ([[1]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-c0bfccaf03a29a5059f6a47c6dd2cdd194fcb1e06fe8e0e188d700a86204f073R27-R36)
,[[2]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-c0bfccaf03a29a5059f6a47c6dd2cdd194fcb1e06fe8e0e188d700a86204f073L53-R63)
,[[3]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-c0bfccaf03a29a5059f6a47c6dd2cdd194fcb1e06fe8e0e188d700a86204f073L71-R73)
)Test Coverage:
ChatContainer.test.tsx
andToolsModal.test.tsx
to mock the updated service classes and ensure proper test isolation. ([[1]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-5bc04b73d213740634c14cc7f3b8c028d08edba97c1c08197b8ed348a3112d47L29-L35)
,[[2]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-5bc04b73d213740634c14cc7f3b8c028d08edba97c1c08197b8ed348a3112d47L98-L103)
,[[3]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-5403659b7ee64a58dcfa7026e4f58e57a731ed7d0cd222e7c4391912bd6d10afL1-R79)
,[[4]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-5403659b7ee64a58dcfa7026e4f58e57a731ed7d0cd222e7c4391912bd6d10afL74-R93)
)Component Updates:
ToolsModal.tsx
andSidebar.tsx
components to use the refactored service classes for fetching data. ([[1]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-63552adfc136b5745280f1413214afb454e46b6558a54e0ac1a62d3076779256L5-R6)
,[[2]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-63552adfc136b5745280f1413214afb454e46b6558a54e0ac1a62d3076779256L21-R23)
,[[3]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-63552adfc136b5745280f1413214afb454e46b6558a54e0ac1a62d3076779256L33)
,[[4]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-5f3a5cc0c274c553bf7e5a260f594f138c16fd5197e1555cb608f862f0120f1cL4-R9)
,[[5]](https://github.com/shaharia-lab/mcp-frontend/pull/14/files#diff-5f3a5cc0c274c553bf7e5a260f594f138c16fd5197e1555cb608f862f0120f1cL36-R38)
)These changes collectively improve the maintainability, reliability, and testability of the codebase.