Files
web/components/Blocks/DynamicContent/SignupFormWrapper/index.tsx
2024-12-12 11:47:44 +01:00

21 lines
674 B
TypeScript

import { redirect } from "next/navigation"
import { overview } from "@/constants/routes/myPages"
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
import SignupForm from "@/components/Forms/Signup"
import { getLang } from "@/i18n/serverContext"
import type { SignupFormWrapperProps } from "@/types/components/blocks/dynamicContent"
export default async function SignupFormWrapper({
dynamic_content,
}: SignupFormWrapperProps) {
const user = await getProfileSafely()
if (user) {
// We don't want to allow users to access signup if they are already authenticated.
redirect(overview[getLang()])
}
return <SignupForm {...dynamic_content} />
}