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 (
<div className="w-full mb-24">
<Metadata>
@ -162,11 +173,9 @@ const PlansSlider = () => {
<div className="text-center my-6">
{(!hasActivePlan || isHigherThanCurrent) &&
(isCurrentPlanPaid ? (
<form method="post" action="/api/stripe/billing">
<Button type="submit">
<Button $primary onClick={manageSubscription}>
Upgrade
</Button>
</form>
) : (
<Button $primary onClick={() => handleSubscribe(plan)}>
Upgrade
@ -174,11 +183,9 @@ const PlansSlider = () => {
))}
{isCurrent && <Button disabled>Current</Button>}
{isLower && (
<form method="post" action="/api/stripe/billing">
<Button type="submit">
<Button $primary onClick={manageSubscription}>
Choose
</Button>
</form>
)}
</div>
{plan.limits && (