Skip to content

Scheduling infrastructure for absolutely everyone.

Fixes undefined bug by replacing BASE_URL with NEXT_PUBLIC_BASE_URL in Shell and signup. (#1991)

Agusti Fernandezeb59908c8465
diff --git a/apps/web/components/Shell.tsx b/apps/web/components/Shell.tsx
index e43864f80cf..75fa88c70b2 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 }) {
<img
className="rounded-full"
src={
- (process.env.NEXT_PUBLIC_APP_URL || process.env.BASE_URL) +
+ (process.env.NEXT_PUBLIC_APP_URL || process.env.NEXT_PUBLIC_BASE_URL) +
"/" +
user?.username +
"/avatar.png"
diff --git a/apps/web/pages/auth/signup.tsx b/apps/web/pages/auth/signup.tsx
index f72775a89f8..28ff2e64125 100644
--- a/apps/web/pages/auth/signup.tsx
+++ b/apps/web/pages/auth/signup.tsx
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import { FormProvider, SubmitHandler, useForm } from "react-hook-form";
import { asStringOrNull } from "@lib/asStringOrNull";
-import { BASE_URL } from "@lib/config/constants";
+import { NEXT_PUBLIC_BASE_URL } from "@lib/config/constants";
import { useLocale } from "@lib/hooks/useLocale";
import prisma from "@lib/prisma";
import { isSAMLLoginEnabled } from "@lib/saml";
@@ -60,7 +60,7 @@ export default function Signup({ email }: Props) {
.then(
async () =>
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}`,
},
};
}