Skip to content

Fix admin claims loader to handle current API response shape#361

Open
GsCommand wants to merge 1 commit into
mainfrom
codex/fix-load-claims-functionality-in-admin-dashboard
Open

Fix admin claims loader to handle current API response shape#361
GsCommand wants to merge 1 commit into
mainfrom
codex/fix-load-claims-functionality-in-admin-dashboard

Conversation

@GsCommand

Copy link
Copy Markdown
Contributor

Motivation

  • The admin claims UI remained stuck on "Loading claims..." because it required d.ok to be truthy and treated valid responses like { claims: [...] } as failures.
  • The goal is to restore the dashboard so clicking Load claims actually loads and renders claims from GET /api/admin/claims without changing payment, webhook, validation, or auth behavior.

Description

  • Updated public/admin/claims.html to robustly parse GET /api/admin/claims responses by reading the raw response, safe-parsing JSON, and accepting Array or { claims: [...] } shapes, while treating only d?.ok === false or non-2xx transport as an application error.
  • Added visible inline error handling so failures display Load failed: <status> — <error or response text> and the page no longer remains stuck on "Loading claims...".
  • Applied the same defensive parsing and inline error reporting to claim detail loading via GET /api/admin/claim?claimId=... so row clicks surface errors instead of silently failing.
  • Added console-safe debugging logs that include endpoint, HTTP status, and response status/error without logging any secrets or the ADMIN_API_KEY.

Testing

  • Ran npm test and all tests passed (82 tests passing).
  • Ran npm run check:links and it reported all local links/assets resolved across HTML files.
  • Ran cd examples/webhook-auto-verify && npm run check and the example checks passed.

Codex Task

@vercel

vercel Bot commented May 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
commandlayer-commandlayer-org Ready Ready Preview, Comment May 27, 2026 3:40am
commandlayer-org Ready Ready Preview, Comment May 27, 2026 3:40am
commandlayer-org111 Ready Ready Preview, Comment May 27, 2026 3:40am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant