Skip to content

Comments

feat(web) improve UX with conditional Login/Profile display#368

Merged
ppcano merged 3 commits intomainfrom
pepe/refactor-auth
Jan 12, 2026
Merged

feat(web) improve UX with conditional Login/Profile display#368
ppcano merged 3 commits intomainfrom
pepe/refactor-auth

Conversation

@ppcano
Copy link
Collaborator

@ppcano ppcano commented Jan 10, 2026

UX: Update header to show "Login" for anonymous users, "Profile" for logged-in users and redirected to main page after logout.

Refactored authentication logic:

  • Add shared auth module (pkg/web/src/lib/auth.ts) with:

    • getCookie(): helper to read cookie values
    • hasUserTokenCookie(): check if auth cookie exists
    • verifyUserLoggedIn(): validate session with backend API
  • Simplify authentication logic:

    • Remove userTokenStore (was storing random tokens unnecessarily)
    • Add isLoggedInStore to track authentication state globally
    • Use cookie-based auth when logged in, anonymous token for guest access
  • Backend: Remove X-Is-Internal header requirement from /api/users/token/authenticate
    endpoint to allow frontend session validation

@ppcano ppcano requested a review from a team as a code owner January 10, 2026 17:51
@ppcano ppcano merged commit fcbc76a into main Jan 12, 2026
14 checks passed
@ppcano ppcano deleted the pepe/refactor-auth branch January 12, 2026 09:28
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