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 <git@agusti.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/1994/head^2
Agusti Fernandez 2022-02-27 23:34:08 +01:00 committed by GitHub
parent 981fb9c5be
commit eb59908c84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -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"

View File

@ -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}`,
},
};
}