Skip to content

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

@Midoriya-w

Description

@Midoriya-w

Problem

The mobile frontend currently performs API requests using repeated raw fetch() calls across multiple screens and contexts.

Authorization headers, request setup, and error handling are manually duplicated in several places such as:

  • AuthContext
  • CardsScreen
  • ConnectPlatformsScreen
  • DevCardViewScreen
  • other mobile screens

This creates several maintainability and scalability issues:

  • duplicated Authorization header logic
  • inconsistent API error handling
  • no centralized handling for 401/403 responses
  • repeated request boilerplate
  • difficult future API maintenance
  • inconsistent session expiration behavior

Currently, expired or invalid tokens may not be handled globally, which can lead to stale sessions or repeated failed requests across the app.


Suggested Improvement

Introduce a centralized API request abstraction layer for the frontend.

Possible implementation ideas:

  • shared fetch wrapper / API client
  • centralized Authorization token injection
  • global 401/403 handling
  • standardized response parsing
  • unified error handling strategy

This would improve maintainability, consistency, and future scalability of the mobile frontend networking layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions