This commit is contained in:
Karol Wypchlo 2021-03-04 15:00:43 +01:00
parent e170be5aa8
commit 27968dd087
2 changed files with 7 additions and 2 deletions

View File

@ -41,7 +41,6 @@ export default async (req, res) => {
} }
const customer = await getStripeCustomer(user, authorization); const customer = await getStripeCustomer(user, authorization);
console.log(customer);
const session = await stripe.checkout.sessions.create({ const session = await stripe.checkout.sessions.create({
mode: "subscription", mode: "subscription",
payment_method_types: ["card"], payment_method_types: ["card"],

View File

@ -2,7 +2,7 @@ import dayjs from "dayjs";
import Layout from "../components/Layout"; import Layout from "../components/Layout";
import useSWR from "swr"; import useSWR from "swr";
import ky from "ky/umd"; import ky from "ky/umd";
import { useState } from "react"; import { useEffect, useState } from "react";
const plans = [ const plans = [
{ {
@ -67,6 +67,12 @@ export default function Payments() {
} }
}; };
useEffect(() => {
if (activePlan && isPaidTier(activePlan.tier)) {
setSelectedPlan(activePlan);
}
}, [activePlan, selectedPlan, setSelectedPlan]);
return ( return (
<Layout title="Payments"> <Layout title="Payments">
<div className="bg-white rounded-lg shadow px-5 py-6 sm:px-6"> <div className="bg-white rounded-lg shadow px-5 py-6 sm:px-6">