Infrastructure medium complexity Shared Component mobile
0
Dependencies
3
Dependents
0
Entities
0
Integrations

Description

Shared HTTP client responsible for all communication between the Flutter mobile app and the Next.js backend REST API at /api/v1/. Attaches JWT bearer tokens to every request, handles 401 token refresh, and serializes/deserializes JSON payloads. Used across all features that communicate with the backend.

Feature: Simple Activity Logging

rest-api-client

Responsibilities

  • Attach Authorization headers with current JWT access token
  • Refresh expired tokens transparently using stored refresh token
  • Serialize request bodies and deserialize JSON responses
  • Surface typed network errors for BLoC error handling

Interfaces

get(path, {queryParams}): Future<Response>
post(path, body): Future<Response>
put(path, body): Future<Response>
patch(path, body): Future<Response>
delete(path): Future<Response>
setAuthToken(token)
clearAuthToken()
refreshToken(): Future<String>

Relationships

Dependents (3)

Components that depend on this component