Skip to content

fix(match,wallet): remove silent mock fallback and add token expiry guard - #842

Open
Mansa147 wants to merge 2 commits into
Arenax-gaming:mainfrom
Mansa147:fix/issues-736-737
Open

fix(match,wallet): remove silent mock fallback and add token expiry guard#842
Mansa147 wants to merge 2 commits into
Arenax-gaming:mainfrom
Mansa147:fix/issues-736-737

Conversation

@Mansa147

Copy link
Copy Markdown
Contributor

closes #736
closes #737

  • Remove try/catch mock-data fallback from useMatch queryFn; API errors now surface naturally via TanStack Query isError
  • Match detail page keyed on isError with dedicated error UI and Retry button; null-data case shows separate not-found state
  • MatchHubDetails import in page changed to type-only from @/types/match
  • Add tests/fixtures/matchFixtures.ts as the single test-only re-export for matchHubDetails and mockMatchDetails; no production file imports these
  • Update match-hub-params test to use new fixture path and isError:true mock
  • Add lib/wallet/tokenExpiry.ts: setTokenExpiresIn, isTokenNearExpiry, isTokenExpired, tokenRemainingMs with 60s EXPIRY_THRESHOLD_MS constant
  • useAuth stores public expiry timestamp after login and refresh; clears on logout
  • Add SessionExpiredModal component for pre-transaction re-auth prompt
  • WalletDashboard checks isTokenNearExpiry() before any withdrawal; on near-expiry attempts silent refresh, shows SessionExpiredModal on failure, replays pending transaction after successful re-auth, redirects to login if refresh fails a second time
  • Add 15 unit tests for tokenExpiry module covering all exported functions

…uard

- Remove try/catch mock-data fallback from useMatch queryFn; API errors
  now surface naturally via TanStack Query isError
- Match detail page keyed on isError with dedicated error UI and Retry
  button; null-data case shows separate not-found state
- MatchHubDetails import in page changed to type-only from @/types/match
- Add __tests__/fixtures/matchFixtures.ts as the single test-only re-export
  for matchHubDetails and mockMatchDetails; no production file imports these
- Update match-hub-params test to use new fixture path and isError:true mock
- Add lib/wallet/tokenExpiry.ts: setTokenExpiresIn, isTokenNearExpiry,
  isTokenExpired, tokenRemainingMs with 60s EXPIRY_THRESHOLD_MS constant
- useAuth stores public expiry timestamp after login and refresh; clears on logout
- Add SessionExpiredModal component for pre-transaction re-auth prompt
- WalletDashboard checks isTokenNearExpiry() before any withdrawal; on
  near-expiry attempts silent refresh, shows SessionExpiredModal on failure,
  replays pending transaction after successful re-auth, redirects to login
  if refresh fails a second time
- Add 15 unit tests for tokenExpiry module covering all exported functions

Closes Arenax-gaming#736
Closes Arenax-gaming#737
@Mansa147
Mansa147 requested a review from anonfedora as a code owner July 30, 2026 02:15
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Mansa147 is attempting to deploy a commit to the paul joseph's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Mansa147 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[frontend] - useMatch Falls Back to Mock Data on API Failure [frontend] - Missing Token Refresh Causes Silent 401s on Wallet Transactions

2 participants