Page Introduction

Page contract details

This contract page maps concrete frontend page behavior to API calls, payloads, and response fields.

  • Use the endpoint matrix as implementation checklist.
  • Use page-specific try-it for fast request verification.
  • Keep request/response shape aligned with listed frontend usage fields.

Platform Page Contract

01 - Landing page (login og registration)

## Page purpose Landing pagen (`/`) handles: - login - registration - email-verified activation før login

4Mapped endpoints
4Frontend files
31Lines
2.1 KBFile size

Source: API-DOC/page-api-mapping/01-ladningside.md

Mapped endpoints for this page

MethodPathScopeUI usageTest
POST/api/ws/auth/sign-upPage-specificCreate ny bruker fra registrationsmodalTry-It
POST/api/ws/auth/sign-inGlobal auth flowInnlogging via NextAuth credentialsTry-It
GET/api/ws/profileGlobal auth flowFetchs i NextAuth etter sign-in to berike sessionTry-It
GET/api/ws/email-verification/confirmPage-related (e-postflyt)Triggeres fra knapp i verifiseringsmail (ikke direkte fra UI-kode)Try-It
POST/api/ws/auth/sign-up

Scope: Page-specific

UI usage: Create ny bruker fra registrationsmodal

Response fields used: data.uid, message

POST/api/ws/auth/sign-in

Scope: Global auth flow

UI usage: Innlogging via NextAuth credentials

Response fields used: data.token, data.user.uid, data.user.orgNr, data.user.username, data.user.profileImage, data.user.verifiedOwner

GET/api/ws/profile

Scope: Global auth flow

UI usage: Fetchs i NextAuth etter sign-in to berike session

Response fields used: email, display_name, profile_image, verified_org (normalisert i frontend)

GET/api/ws/email-verification/confirm

Scope: Page-related (e-postflyt)

UI usage: Triggeres fra knapp i verifiseringsmail (ikke direkte fra UI-kode)

Response fields used: confirmation/error message for email verification

Try this page endpoints

Interactive console below is filtered to endpoints mapped for this page contract.

Source markdown

01 - Landing page (login og registration)

Page purpose

Landing pagen (/) handles:

  • login
  • registration
  • email-verified activation før login

Frontend methods and components

  • src/app/page.tsx: controls modal-flyt (login/register/confirmation)
  • src/features/auth/LoginModal.tsx: signIn('credentials')
  • src/features/auth/RegisterModal.tsx: registerUser(...)
  • src/pages/api/auth/[...nextauth].ts: credentials-authorize against backend (loginUser, getUserProfile)

Endpoint matrix

Scope Method Endpoint UI usage Request from frontend Response fields used by frontend
Page-specific POST /api/ws/auth/sign-up Create ny bruker fra registrationsmodal email, password, display_name, phone_number, valgfri file (profilbilde) data.uid, message
Global auth flow POST /api/ws/auth/sign-in Innlogging via NextAuth credentials email, password (+ x-api-key) data.token, data.user.uid, data.user.orgNr, data.user.username, data.user.profileImage, data.user.verifiedOwner
Global auth flow GET /api/ws/profile Fetchs i NextAuth etter sign-in to berike session Bearer-token email, display_name, profile_image, verified_org (normalisert i frontend)
Page-related (e-postflyt) GET /api/ws/email-verification/confirm?token=... Triggeres fra knapp i verifiseringsmail (ikke direkte fra UI-kode) token i query confirmation/error message for email verification

What frontend expects from backend

  • Registrering skal returnere tydelig melding om at e-post må bekreftes.
  • Innlogging skal feile med klar feilkode hvis e-post ikke er verifisert.
  • Sign-in-respons må gi token + nok brukerdata til å bygge session uten ekstra kall, men frontend tåler ekstra profile-lookup.

Fallback og dependencies

  • Login går via NextAuth route (/api/auth/callback/credentials) før backend-endepunkt kalles.
  • E-postconfirmation er en ekstern brukerhandling (mail -> klikk -> backend), men er funksjonelt en del av ladningside-flyten.