This commit is contained in:
Michał Leszczyk 2022-05-25 13:58:33 +02:00
parent 583575f5ea
commit f798035a17
No known key found for this signature in database
GPG Key ID: FA123CA8BAA2FBF4
1 changed files with 17 additions and 10 deletions

View File

@ -112,6 +112,17 @@ const PlansSlider = () => {
} }
}; };
const manageSubscription = async () => {
try {
const response = await accountsService.post("stripe/billing");
console.log(response);
debugger;
} catch (error) {
setShowPaymentError(true);
console.error(error);
}
};
return ( return (
<div className="w-full mb-24"> <div className="w-full mb-24">
<Metadata> <Metadata>
@ -162,11 +173,9 @@ const PlansSlider = () => {
<div className="text-center my-6"> <div className="text-center my-6">
{(!hasActivePlan || isHigherThanCurrent) && {(!hasActivePlan || isHigherThanCurrent) &&
(isCurrentPlanPaid ? ( (isCurrentPlanPaid ? (
<form method="post" action="/api/stripe/billing"> <Button $primary onClick={manageSubscription}>
<Button type="submit">
Upgrade Upgrade
</Button> </Button>
</form>
) : ( ) : (
<Button $primary onClick={() => handleSubscribe(plan)}> <Button $primary onClick={() => handleSubscribe(plan)}>
Upgrade Upgrade
@ -174,11 +183,9 @@ const PlansSlider = () => {
))} ))}
{isCurrent && <Button disabled>Current</Button>} {isCurrent && <Button disabled>Current</Button>}
{isLower && ( {isLower && (
<form method="post" action="/api/stripe/billing"> <Button $primary onClick={manageSubscription}>
<Button type="submit">
Choose Choose
</Button> </Button>
</form>
)} )}
</div> </div>
{plan.limits && ( {plan.limits && (