Skip to content

feat: add centralized API request abstraction for web frontend#339

Merged
ShantKhatri merged 1 commit into
Dev-Card:mainfrom
Midoriya-w:feat/web-api-client
May 27, 2026
Merged

feat: add centralized API request abstraction for web frontend#339
ShantKhatri merged 1 commit into
Dev-Card:mainfrom
Midoriya-w:feat/web-api-client

Conversation

@Midoriya-w
Copy link
Copy Markdown
Contributor

Closes #326

Changes:

  • Added apps/web/src/lib/apiClient.ts — shared API request abstraction for the SvelteKit web frontend
  • Replaces scattered raw fetch() calls across AuthContext and multiple screens with a single reusable utility
  • Centralizes Authorization header injection so token logic lives in one place
  • Adds global 401/403 handling via onUnauthorized callback — ensures expired sessions are cleaned up consistently
  • Standardizes response parsing and error messages across all web API calls
  • Makes future API changes (base URL, headers, retries) a single-file update instead of touching every screen

@Harxhit Harxhit added the gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. label May 26, 2026
@ShantKhatri ShantKhatri merged commit f4213b6 into Dev-Card:main May 27, 2026
1 check failed
@Harxhit Harxhit added level:advanced Complex contribution involving deeper technical work. (+55 pts) quality:clean PR is well-structured, readable, and follows good practices. (×1.2 multiplier) type:performance Performance optimization (+15 pts) type:refactor Code refactoring/cleanup (+10 pts) type:security Security-related fixes/improvements (+20 pts) labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. level:advanced Complex contribution involving deeper technical work. (+55 pts) quality:clean PR is well-structured, readable, and follows good practices. (×1.2 multiplier) type:performance Performance optimization (+15 pts) type:refactor Code refactoring/cleanup (+10 pts) type:security Security-related fixes/improvements (+20 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frontend API requests lack centralized request abstraction and global auth error handling

3 participants