Skip to content

frontend


Function: default()

default(children): ReactNode

Defined in: src/auth/GuestOnly.tsx:32

GuestOnly

Route protection component that ensures only unauthenticated users can access child routes. Redirects authenticated users to the application home page.

Used for login and registration pages to prevent authenticated users from accessing them. Performs full navigation (window.location.assign) to ensure proper base URL handling with trailing slash.

Parameters

children

Guest-only route components (login, register)

children

ReactNode

Returns

ReactNode

Example

<Route path="/login" element={
  <GuestOnly>
    <LoginPage />
  </GuestOnly>
} />