Fix App Redirect logic to allow EventTypeApps requiring auth to correctly redirect (#5065)

Co-authored-by: zomars <zomars@me.com>
pull/5067/head^2
Hariom Balhara 2022-10-18 16:48:39 +05:30 committed by GitHub
parent 2e169801e8
commit 4211ec1a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 21 deletions

View File

@ -39,10 +39,15 @@ function useAddAppMutation(_type: App["type"] | null, options?: Parameters<typeo
}
const json = await res.json();
if (!isOmniInstall) {
window.location.href = json.url;
return;
}
// Skip redirection only if it is an OmniInstall and redirect URL isn't of some other origin
// This allows installation of apps like Stripe to still redirect to their authentication pages.
// TODO: For Omni installation to authenticate and come back to the page where installation was initiated, some changes need to be done in all apps' add callbacks
if (!(isOmniInstall && !json.url.startsWith(window.location.origin))) {
if (!json.url.startsWith(window.location.origin)) {
window.location.href = json.url;
}
}, options);

View File

@ -21,7 +21,6 @@ export const InstallAppButtonMap = {
office365video: dynamic(() => import("./office365video/components/InstallAppButton")),
riverside: dynamic(() => import("./riverside/components/InstallAppButton")),
slackmessaging: dynamic(() => import("./slackmessaging/components/InstallAppButton")),
stripepayment: dynamic(() => import("./stripepayment/components/InstallAppButton")),
tandemvideo: dynamic(() => import("./tandemvideo/components/InstallAppButton")),
vital: dynamic(() => import("./vital/components/InstallAppButton")),
whereby: dynamic(() => import("./whereby/components/InstallAppButton")),

View File

@ -1,18 +0,0 @@
import type { InstallAppButtonProps } from "@calcom/app-store/types";
import useAddAppMutation from "../../_utils/useAddAppMutation";
export default function InstallAppButton(props: InstallAppButtonProps) {
const mutation = useAddAppMutation("stripe_payment");
return (
<>
{props.render({
onClick() {
mutation.mutate("");
},
loading: mutation.isLoading,
})}
</>
);
}

View File

@ -1,2 +1 @@
export { default as InstallAppButton } from "./InstallAppButton";
export { WipeMyCalActionButton } from "./wipeMyCalActionButton";