Files
portabase/app/(landing)/page.tsx
T

19 lines
637 B
TypeScript
Raw Normal View History

2025-05-16 15:54:17 +02:00
import { redirect } from "next/navigation";
import { getCurrentOrganizationSlug } from "@/features/organizations/utils/organization-cookie";
2025-05-16 15:54:17 +02:00
import { currentUser } from "@/lib/auth/current-user";
2026-06-22 16:56:17 +02:00
import { isOnboardingDone } from "@/db/services/setting";
import { env } from "@/env.mjs";
2024-11-03 21:12:40 +01:00
2024-11-03 15:29:30 +01:00
export default async function Index() {
2026-06-22 16:56:17 +02:00
if (env.SKIP_ONBOARDING !== "true" && !(await isOnboardingDone())) {
redirect("/welcome");
}
2025-05-16 15:54:17 +02:00
const user = await currentUser();
2024-11-03 15:29:30 +01:00
if (user) {
2025-05-16 15:54:17 +02:00
const currentOrganizationSlug = await getCurrentOrganizationSlug();
2025-07-26 14:43:59 +02:00
redirect(`/dashboard/home`);
2024-11-03 15:29:30 +01:00
}
2025-05-16 15:54:17 +02:00
redirect("/login");
2024-11-03 15:29:30 +01:00
}