Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

435 B
Raw Blame
import type { LoaderFunctionArgs } from 'react-router'
import { redirect } from 'react-router'

import { isSelfhosted } from '~/lib/constants'

export async function loader({ params }: LoaderFunctionArgs) {
  if (isSelfhosted) {
    return redirect('/login', 302)
  }

  const { page } = params

  const init = {
    status: 302,
  }

  const redirectPath = page === 'index' ? '/' : `/${page}`

  return redirect(redirectPath, init)
}