18 lines
544 B
TypeScript
18 lines
544 B
TypeScript
// app/dashboard/page.tsx
|
|
import { redirect } from "next/navigation";
|
|
import { getServerSession } from "next-auth/next";
|
|
import { authOptions } from "@/app/api/auth/[...nextauth]/route"; // Changed from handler to authOptions
|
|
|
|
export default async function DashboardBasePage() {
|
|
|
|
const session = await getServerSession(authOptions);
|
|
// if user is not aunthenticated then its redirects to the
|
|
// login page else redirect to dashboard page
|
|
if (!session) {
|
|
redirect("/login");
|
|
}
|
|
else{
|
|
redirect("/dashboard/overview/dashboard");
|
|
}
|
|
}
|
|
|