Add i18n support with Next.js App Router and Dictionaries
This commit is contained in:
17
app/[lang]/page.tsx
Normal file
17
app/[lang]/page.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { auth } from "@/auth";
|
||||
|
||||
export default async function HomePage(
|
||||
props: {
|
||||
params: Promise<{ lang: string }>;
|
||||
}
|
||||
) {
|
||||
const params = await props.params;
|
||||
|
||||
const session = await auth();
|
||||
if (session) {
|
||||
redirect(`/${params.lang}/dashboard`);
|
||||
} else {
|
||||
redirect(`/${params.lang}/login`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user