Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #593 from beabee-communityrm/fix/join-embed-redirect2
Browse files Browse the repository at this point in the history
Redirect in parent window when embedded
  • Loading branch information
wpf500 authored May 10, 2024
2 parents c76e748 + 974b3fb commit 67fa730
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pages/join/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ import AuthBox from '@components/AuthBox.vue';
import { fetchContent } from '@utils/api/content';
import { signUp, completeUrl } from '@utils/api/signup';
import { generalContent } from '@store';
import { generalContent, isEmbed } from '@store';
import type { ContentJoin } from '@type';
Expand Down Expand Up @@ -97,12 +97,17 @@ const { signUpData, signUpDescription } = useJoin(joinContent);
async function submitSignUp() {
const data = await signUp(signUpData);
const topWindow = window.top || window;
if (data.redirectUrl) {
(window.top || window).location.href = data.redirectUrl;
topWindow.location.href = data.redirectUrl;
} else if (data.clientSecret) {
stripeClientSecret.value = data.clientSecret;
} else {
router.push({ path: '/join/confirm-email' });
if (isEmbed) {
topWindow.location.href = '/join/confirm-email';
} else {
router.push({ path: '/join/confirm-email' });
}
}
}
Expand Down

0 comments on commit 67fa730

Please sign in to comment.