Skip to content

feat: extract API services and refactor components to use apiClient#470

Merged
codeZe-us merged 1 commit into
SafeVault:mainfrom
AdityaK9822:feat/api-service-extraction
May 1, 2026
Merged

feat: extract API services and refactor components to use apiClient#470
codeZe-us merged 1 commit into
SafeVault:mainfrom
AdityaK9822:feat/api-service-extraction

Conversation

@AdityaK9822
Copy link
Copy Markdown
Contributor

Description

This PR modernizes the frontend API integration by systematically extracting scattered inline fetch calls from UI components into centralized, domain-specific service classes.

All API interactions are now routed through the apiClient, ensuring consistent communication, centralized error handling, and end-to-end type safety across the frontend application.

Closes #432

What I Did

  • Expanded Domain Services: Created and expanded service files in src/lib/api/* (employees.ts, finance.ts, team.ts, kyb.ts, auth.ts, organization.ts) to encompass all endpoints previously hardcoded in UI components.
  • Refactored UI Components: Migrated components to import methods strictly from the domain services instead of defining fetch configurations internally. Key components updated include:
    • AccountManagement & AccountForm
    • AddFundsModal
    • RegistrationWizard & business-details
    • CompleteKYB & CreateTimeOffForm
    • Relevant page files in finance, team, invite, and settings
  • Added apiClient PATCH support: Introduced a patch HTTP method to the core API client.
  • Handled Edge Cases: Successfully abstracted multi-step presigned S3 upload flows (e.g., Logo and KYB documents) into the service layer while maintaining required external PUT requests.

Testing & Verification

  • Checked the frontend directory to verify that no internal /api/v1/ inline fetch calls remain.
  • Validated that all frontend components conform cleanly to the new service class TypeScript interfaces.
  • Ensured error payloads from the API correctly bubble up via the normalized RequestError handling.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

@AdityaK9822 is attempting to deploy a commit to the vestroll's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codeZe-us codeZe-us merged commit 10735f1 into SafeVault:main May 1, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor and Extract API Client

2 participants