From eb59908c8465854db59649a9d0e519cd7ac9f024 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Date: Sun, 27 Feb 2022 23:34:08 +0100 Subject: [PATCH] Fixes undefined bug by replacing BASE_URL with NEXT_PUBLIC_BASE_URL in Shell and signup. (#1991) * Replace BASE_URL with NEXT_PUBLIC_BASE_URL in Shell * Replace BASE_URL with NEXT_PUBLIC_BASE_URL in apps/web/pages/auth/signup Co-authored-by: Agusti Fernandez Pardo Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/web/components/Shell.tsx | 6 +++--- apps/web/pages/auth/signup.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/web/components/Shell.tsx b/apps/web/components/Shell.tsx index e43864f80c..75fa88c70b 100644 --- a/apps/web/components/Shell.tsx +++ b/apps/web/components/Shell.tsx @@ -22,7 +22,7 @@ import TrialBanner from "@ee/components/TrialBanner"; import HelpMenuItemDynamic from "@ee/lib/intercom/HelpMenuItemDynamic"; import classNames from "@lib/classNames"; -import { BASE_URL } from "@lib/config/constants"; +import { NEXT_PUBLIC_BASE_URL } from "@lib/config/constants"; import { shouldShowOnboarding } from "@lib/getting-started"; import { useLocale } from "@lib/hooks/useLocale"; import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry"; @@ -62,7 +62,7 @@ function useRedirectToLoginIfUnauthenticated() { router.replace({ pathname: "/auth/login", query: { - callbackUrl: `${BASE_URL}/${location.pathname}${location.search}`, + callbackUrl: `${NEXT_PUBLIC_BASE_URL}/${location.pathname}${location.search}`, }, }); } @@ -380,7 +380,7 @@ function UserDropdown({ small }: { small?: boolean }) { await signIn("Cal.com", { - callbackUrl: (`${BASE_URL}/${router.query.callbackUrl}` || "") as string, + callbackUrl: (`${NEXT_PUBLIC_BASE_URL}/${router.query.callbackUrl}` || "") as string, }) ) .catch((err) => { @@ -130,7 +130,7 @@ export default function Signup({ email }: Props) { className="w-5/12 justify-center" onClick={() => signIn("Cal.com", { - callbackUrl: (`${BASE_URL}/${router.query.callbackUrl}` || "") as string, + callbackUrl: (`${NEXT_PUBLIC_BASE_URL}/${router.query.callbackUrl}` || "") as string, }) }> {t("login_instead")} @@ -184,7 +184,7 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => { return { redirect: { permanent: false, - destination: "/auth/login?callbackUrl=" + `${BASE_URL}/${ctx.query.callbackUrl}`, + destination: "/auth/login?callbackUrl=" + `${NEXT_PUBLIC_BASE_URL}/${ctx.query.callbackUrl}`, }, }; }