Skip to article
Documentation

src/app/page.tsx

Linked repository file from this build.

import { redirect } from "next/navigation";
import { LandingPage } from "@/components/landing-page";
import { AccountSetupError, getActor } from "@/lib/auth/server";
import { AccessError } from "@/lib/auth/scope";

export default async function Home() {
  try {
    await getActor();
  } catch (error) {
    if (error instanceof AccountSetupError) redirect("/account-setup");
    if (error instanceof AccessError) return <LandingPage />;
    throw error;
  }
  redirect("/dashboard");
}