Fix App Redirect logic to allow EventTypeApps requiring auth to correctly redirect (#5065)
Co-authored-by: zomars <zomars@me.com>pull/5067/head^2
parent
2e169801e8
commit
4211ec1a82
|
@ -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);
|
||||
|
|
|
@ -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")),
|
||||
|
|
|
@ -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,
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
|
@ -1,2 +1 @@
|
|||
export { default as InstallAppButton } from "./InstallAppButton";
|
||||
export { WipeMyCalActionButton } from "./wipeMyCalActionButton";
|
||||
|
|
Loading…
Reference in New Issue