Fixes connectionIntegration undefined bug (#1987)

* Fixes connectionIntegration undefined bug

* fixes adding NEXT_PUBLIC_BASE_URL to consts and using that

Co-authored-by: Agusti Fernandez Pardo <git@agusti.me>
This commit is contained in:
Agusti Fernandez 2022-02-26 20:27:52 +01:00 committed by GitHub
parent 48f969eae5
commit 5d4cbe37eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -2,7 +2,7 @@ import type { IntegrationOAuthCallbackState } from "pages/api/integrations/types
import { useState } from "react";
import { useMutation } from "react-query";
import { BASE_URL } from "@lib/config/constants";
import { NEXT_PUBLIC_BASE_URL } from "@lib/config/constants";
import { AddAppleIntegrationModal } from "@lib/integrations/calendar/components/AddAppleIntegration";
import { AddCalDavIntegrationModal } from "@lib/integrations/calendar/components/AddCalDavIntegration";
@ -18,7 +18,7 @@ export default function ConnectIntegration(props: {
const mutation = useMutation(async () => {
const state: IntegrationOAuthCallbackState = {
returnTo: BASE_URL + location.pathname + location.search,
returnTo: NEXT_PUBLIC_BASE_URL + location.pathname + location.search,
};
const stateStr = encodeURIComponent(JSON.stringify(state));
const searchParams = `?state=${stateStr}`;

View file

@ -3,3 +3,4 @@ export const WEBSITE_URL = process.env.NEXT_PUBLIC_APP_URL || "https://cal.com";
export const IS_PRODUCTION = process.env.NODE_ENV === "production";
export const TRIAL_LIMIT_DAYS = 14;
export const HOSTED_CAL_FEATURES = process.env.HOSTED_CAL_FEATURES || BASE_URL === "https://app.cal.com";
export const NEXT_PUBLIC_BASE_URL = process.env.NEXT_PUBLIC_BASE_URL || `https://${process.env.VERCEL_URL}`;