chore: added varaible enable OAuth

This commit is contained in:
Henit Chobisa 2023-09-06 06:33:01 +00:00
parent 260b752ae4
commit 4aac7ffac1
3 changed files with 12 additions and 6 deletions

View File

@ -43,7 +43,7 @@ const HomePage: NextPage = observer(() => {
const { setTheme } = useTheme();
const {
publicRuntimeConfig: { PROJECT_API },
publicRuntimeConfig: { NEXT_PUBLIC_ENABLE_OAUTH },
} = getConfig()
const { isLoading, mutateUser } = useUserAuth("sign-in");
@ -178,10 +178,10 @@ const HomePage: NextPage = observer(() => {
</>
<div className="grid place-items-center h-full overflow-y-auto py-5 px-7">
<div>
{parseInt(process.env.NEXT_PUBLIC_ENABLE_OAUTH || "0") ? (
{parseInt(NEXT_PUBLIC_ENABLE_OAUTH || "0") ? (
<>
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-custom-text-100">
{ `Sign in to ${PROJECT_API} Plane` }
{ `Sign in to Plane` }
</h1>
<div className="flex flex-col divide-y divide-custom-border-200">
<div className="pb-7">
@ -197,7 +197,7 @@ const HomePage: NextPage = observer(() => {
<EmailPasswordForm onSubmit={handlePasswordSignIn} />
)}
{parseInt(process.env.NEXT_PUBLIC_ENABLE_OAUTH || "0") ? (
{parseInt(NEXT_PUBLIC_ENABLE_OAUTH || "0") ? (
<p className="pt-16 text-custom-text-200 text-sm text-center">
By signing up, you agree to the{" "}
<a

View File

@ -19,6 +19,7 @@ import { Input, PrimaryButton, Spinner } from "components/ui";
import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png";
// types
import type { NextPage } from "next";
import getConfig from "next/config";
type FormData = {
password: string;
@ -28,6 +29,8 @@ type FormData = {
const ResetPasswordPage: NextPage = () => {
const [isLoading, setIsLoading] = useState(true);
const { publicRuntimeConfig: { NEXT_PUBLIC_ENABLE_OAUTH } } = getConfig();
const router = useRouter();
const { uidb64, token } = router.query;
@ -85,7 +88,7 @@ const ResetPasswordPage: NextPage = () => {
}, [setTheme]);
useEffect(() => {
if (parseInt(process.env.NEXT_PUBLIC_ENABLE_OAUTH || "0")) router.push("/");
if (parseInt(NEXT_PUBLIC_ENABLE_OAUTH || "0")) router.push("/");
else setIsLoading(false);
}, [router]);

View File

@ -18,6 +18,7 @@ import { EmailPasswordForm } from "components/account";
import { Spinner } from "components/ui";
// images
import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png";
import getConfig from "next/config";
// types
import type { NextPage } from "next";
type EmailPasswordFormValues = {
@ -29,6 +30,8 @@ type EmailPasswordFormValues = {
const SignUp: NextPage = () => {
const [isLoading, setIsLoading] = useState(true);
const { publicRuntimeConfig: { NEXT_PUBLIC_ENABLE_OAUTH } } = getConfig();
const router = useRouter();
const { setToastAlert } = useToast();
@ -71,7 +74,7 @@ const SignUp: NextPage = () => {
}, [setTheme]);
useEffect(() => {
if (parseInt(process.env.NEXT_PUBLIC_ENABLE_OAUTH || "0")) router.push("/");
if (parseInt(NEXT_PUBLIC_ENABLE_OAUTH || "0")) router.push("/");
else setIsLoading(false);
}, [router]);