Skip to content

Split login/register into separate routes#34

Merged
cfuehrmann merged 1 commit into
mainfrom
split-auth-routes
Feb 14, 2026
Merged

Split login/register into separate routes#34
cfuehrmann merged 1 commit into
mainfrom
split-auth-routes

Conversation

@cfuehrmann

Copy link
Copy Markdown
Owner

Summary

  • Split the combined /login page into separate /login and /register routes
  • Extract shared getErrorMessage utility to src/lib/errors.ts
  • Replace toggle buttons with Next.js Link components for navigation between routes

Why

The login page used conditional rendering (showRegistration state) to toggle between login and registration views. Separate routes are better:

  • Deep linking — you can link directly to /register
  • Browser history — back button works naturally between the two pages
  • Simpler components — each page does one thing, no conditional state
  • Analytics — distinct page views without custom event tracking

Changes

File Change
src/lib/errors.ts New — extracted getErrorMessage shared by both pages
src/app/(auth)/register/page.tsx New — registration page with its own Suspense fallback
src/app/(auth)/login/page.tsx Simplified — login only, removed all registration code
tests/e2e/auth.spec.ts Updated — tests navigate directly to /register instead of clicking through /login

The "can toggle between login and registration views" test is replaced with "login page links to register and vice versa" which verifies the Link navigation between routes.

All checks pass: build, lint, format, knip, unit tests, 11/11 e2e tests.

@cfuehrmann cfuehrmann merged commit f8891c3 into main Feb 14, 2026
6 checks passed
@cfuehrmann cfuehrmann deleted the split-auth-routes branch February 14, 2026 17:07
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.

1 participant