Skip to content

Commit

Permalink
fix: static rendering for sign in and sign up page
Browse files Browse the repository at this point in the history
  • Loading branch information
ixartz committed Nov 20, 2024
1 parent 2b73152 commit 2b6e75f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/app/[locale]/(auth)/(center)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { auth } from '@clerk/nextjs/server';
import { redirect } from 'next/navigation';
import { setRequestLocale } from 'next-intl/server';

export default async function CenteredLayout(props: { children: React.ReactNode }) {
const { userId } = await auth();

if (userId) {
redirect('/dashboard');
}
export default async function CenteredLayout(props: {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}) {
const { locale } = await props.params;
setRequestLocale(locale);

return (
<div className="flex min-h-screen items-center justify-center">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getI18nPath } from '@/utils/Helpers';
import { SignIn } from '@clerk/nextjs';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

type ISignInPageProps = {
params: Promise<{ locale: string }>;
Expand All @@ -21,6 +21,7 @@ export async function generateMetadata(props: ISignInPageProps) {

export default async function SignInPage(props: ISignInPageProps) {
const { locale } = await props.params;
setRequestLocale(locale);

return (
<SignIn path={getI18nPath('/sign-in', locale)} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getI18nPath } from '@/utils/Helpers';
import { SignUp } from '@clerk/nextjs';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

type ISignUpPageProps = {
params: Promise<{ locale: string }>;
Expand All @@ -21,6 +21,7 @@ export async function generateMetadata(props: ISignUpPageProps) {

export default async function SignUpPage(props: ISignUpPageProps) {
const { locale } = await props.params;
setRequestLocale(locale);

return (
<SignUp path={getI18nPath('/sign-up', locale)} />
Expand Down

0 comments on commit 2b6e75f

Please sign in to comment.