Files
swiss-datashare/frontend/src/pages/auth/signUp.tsx

26 lines
635 B
TypeScript
Raw Normal View History

import getConfig from "next/config";
2022-04-25 15:15:17 +02:00
import { useRouter } from "next/router";
import AuthForm from "../../components/auth/AuthForm";
2022-04-28 15:31:37 +02:00
import Meta from "../../components/Meta";
import useUser from "../../hooks/user.hook";
2022-04-25 15:15:17 +02:00
const { publicRuntimeConfig } = getConfig();
2022-04-25 15:15:17 +02:00
const SignUp = () => {
const user = useUser();
2022-04-25 15:15:17 +02:00
const router = useRouter();
if (user) {
2022-04-25 15:15:17 +02:00
router.replace("/");
} else if (publicRuntimeConfig.ALLOW_REGISTRATION == "false") {
2022-05-02 11:19:24 +02:00
router.replace("/auth/signIn");
2022-04-25 15:15:17 +02:00
} else {
2022-04-28 15:31:37 +02:00
return (
<>
<Meta title="Sign Up" />
<AuthForm mode="signUp" />
</>
);
2022-04-25 15:15:17 +02:00
}
};
export default SignUp;