From ccb3bfba71ffcde3c49d091c473b770bef4dd4b6 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Wed, 3 Mar 2021 16:12:24 +0100 Subject: [PATCH] payments --- packages/dashboard/src/pages/payments.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/dashboard/src/pages/payments.js b/packages/dashboard/src/pages/payments.js index 84f3d23c..f79a9b24 100644 --- a/packages/dashboard/src/pages/payments.js +++ b/packages/dashboard/src/pages/payments.js @@ -1,7 +1,6 @@ import dayjs from "dayjs"; import Layout from "../components/Layout"; import useSWR from "swr"; -import { useEffect } from "react"; import ky from "ky/umd"; import { useState } from "react"; @@ -55,6 +54,7 @@ export default function Payments() { const { data: user } = useSWR(`${apiPrefix}/user`, fetcher); const [selectedPlan, setSelectedPlan] = useState(plans[0]); const activePlan = plans.find(({ tier }) => user?.tier === tier); + const isFreePlan = ({ tier }) => tier === 1; const handleSubscribe = async () => { try { const price = selectedPlan.stripe; @@ -75,14 +75,14 @@ export default function Payments() {
Current plan
-
Free
+
{activePlan.name}
Subscription status
- {user?.subscriptionStatus ?? "—"} + {isFreePlan(activePlan) ? "—" : user?.subscriptionStatus}
{user?.subscriptionCancelAtPeriodEnd && (