Skip to content

Commit

Permalink
Merge branch 'stripe_cancel' of https://github.com/labdao/plex into s…
Browse files Browse the repository at this point in the history
…tripe_cancel
  • Loading branch information
supraja-968 committed Jul 31, 2024
2 parents 5dcc3ed + 04ca2c3 commit 54bf3ba
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,8 @@ export default function NewExperimentForm({ task }: { task: any }) {
toast.error("Failed to start experiment");
}
} else {
// Paid tier user without active subscription, initiate checkout process
const result = await dispatch(addExperimentWithCheckoutThunk(transformedPayload)).unwrap();
if (result.checkout) {
// User needs to subscribe, redirect to checkout
window.location.href = result.checkout.url;
} else if (result && result.ID) {
// Experiment was created successfully (this case might not occur for non-subscribed users)
console.log("Experiment created", result);
router.push(`/experiments/${result.ID}`, { scroll: false });
dispatch(experimentListThunk(walletAddress));
toast.success("Experiment started successfully");
} else {
console.log("Something went wrong", result);
toast.error("Failed to start experiment");
}
// Paid tier user without active subscription, redirect to subscription page
router.push('/subscribe');
}
} else {
console.error("Invalid user tier");
Expand Down

0 comments on commit 54bf3ba

Please sign in to comment.