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:
		
							parent
							
								
									48f969eae5
								
							
						
					
					
						commit
						5d4cbe37eb
					
				
					 2 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -2,7 +2,7 @@ import type { IntegrationOAuthCallbackState } from "pages/api/integrations/types
 | 
				
			||||||
import { useState } from "react";
 | 
					import { useState } from "react";
 | 
				
			||||||
import { useMutation } from "react-query";
 | 
					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 { AddAppleIntegrationModal } from "@lib/integrations/calendar/components/AddAppleIntegration";
 | 
				
			||||||
import { AddCalDavIntegrationModal } from "@lib/integrations/calendar/components/AddCalDavIntegration";
 | 
					import { AddCalDavIntegrationModal } from "@lib/integrations/calendar/components/AddCalDavIntegration";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,7 @@ export default function ConnectIntegration(props: {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const mutation = useMutation(async () => {
 | 
					  const mutation = useMutation(async () => {
 | 
				
			||||||
    const state: IntegrationOAuthCallbackState = {
 | 
					    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 stateStr = encodeURIComponent(JSON.stringify(state));
 | 
				
			||||||
    const searchParams = `?state=${stateStr}`;
 | 
					    const searchParams = `?state=${stateStr}`;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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 IS_PRODUCTION = process.env.NODE_ENV === "production";
 | 
				
			||||||
export const TRIAL_LIMIT_DAYS = 14;
 | 
					export const TRIAL_LIMIT_DAYS = 14;
 | 
				
			||||||
export const HOSTED_CAL_FEATURES = process.env.HOSTED_CAL_FEATURES || BASE_URL === "https://app.cal.com";
 | 
					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}`;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue