Skip to content

Fix/token error management#30

Merged
surafelfikru merged 4 commits into
Qoba-ai:mainfrom
surafelfikru:fix/token-error-management
Mar 11, 2026
Merged

Fix/token error management#30
surafelfikru merged 4 commits into
Qoba-ai:mainfrom
surafelfikru:fix/token-error-management

Conversation

@DagmawiKK

Copy link
Copy Markdown
Contributor

Description

This pull request improves the authentication flow and user experience on the tokens management page. It adds better handling for unauthorized API responses, ensures the root token input is updated reactively, and improves the logic for displaying token content. The most important changes are grouped by authentication handling, UI/UX improvements, and state management:

Authentication Handling:

  • The request function in api.ts now throws a specific "Unauthorized" error when a 401 or 403 response is received, making it easier to handle authentication failures downstream.
  • In tokens/lib.ts, when an "Unauthorized" error is caught during token fetching, the root token is cleared, removed from local storage, and a descriptive toast notification is shown to the user.

UI/UX Improvements:

  • The tokens page now only shows token management content if a valid root token is present, tokens are done loading, and there are tokens to display, preventing UI glitches when tokens are missing or loading.
  • The root token input field in RootTokenForm.tsx is now controlled by a signal that updates whenever the initial token prop changes, ensuring the input stays in sync with the app state.

State Management:

  • The setRootToken function is now imported and used in tokens/lib.ts to clear the root token on authentication failure.

These changes collectively improve error handling, user feedback, and the reliability of the token management workflow.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have read the Contributing Guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

@vercel

vercel Bot commented Feb 13, 2026

Copy link
Copy Markdown

@DagmawiKK is attempting to deploy a commit to the timverhaegen's projects Team on Vercel.

A member of the Team first needs to authorize it.

@surafelfikru surafelfikru merged commit 3c3a65e into Qoba-ai:main Mar 11, 2026
1 of 2 checks passed
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.

2 participants