confirm plan switch with a modal

This commit is contained in:
m5r
2021-10-25 00:32:33 +02:00
parent 24ce9d4a62
commit 37d9bd37f4
5 changed files with 131 additions and 62 deletions

View File

@ -93,12 +93,9 @@ export default function useSubscription({ initialData }: Params = {}) {
};
async function changePlan({ planId }: ChangePlanParams) {
if (planId === -1) {
return cancelSubscription({ cancelUrl: subscription!.cancelUrl });
}
try {
await updateSubscriptionMutation({ planId });
setIsWaitingForSubChange(true);
} catch (error) {
console.log("error", error);
}