Skip to content

fix(frontend): getUpcomingPurchases declares an array but the API returns { purchases } #1189

Closed

Description

@cristim

Summary

getUpcomingPurchases() in the frontend API layer declares Promise<UpcomingPurchase[]>, but /api/dashboard/upcoming returns an object with a purchases array. The dashboard consumers cast around the mismatch instead of using the real type.

Evidence (origin/main)

  • frontend/src/api/*: getUpcomingPurchases(): Promise<UpcomingPurchase[]> calls apiRequest<UpcomingPurchase[]>('/dashboard/upcoming').
  • Tests already mock the real shape (dashboard-ownership-950.test.ts:159 resolves { purchases: [...] }).
  • The Go handler returns { purchases: [...] } (internal/api/handler_dashboard.go, getUpcomingPurchases).

Proposed fix

Declare Promise<{ purchases: UpcomingPurchase[] }>, drop the casts in the dashboard consumers, and let tsc check both call sites.

Found by CodeRabbit on #1186. The mismatch predates that PR.

Activity

  1. IAmJSD commented on Oct 24, 2026

    @IAmJSD
    Collaborator

    Claiming: working on this

  2. self-assigned this
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions