diff --git a/src/components/SettingView.tsx b/src/components/SettingView.tsx index 4fffe3b..1b9c21e 100644 --- a/src/components/SettingView.tsx +++ b/src/components/SettingView.tsx @@ -17,7 +17,7 @@ const SettingView = () => { const { data: session } = useSession(); return ( -
+
{ // Fetch CheckoutSession from static page via // https://nextjs.org/docs/basic-features/data-fetching#static-generation - const { data, error } = useSWR( - router.query.session_id ? `/api/checkout_sessions/${sessionId}` : null, - fetchGetJSON - ); + const { data } = useSWR(router.query.session_id ? `/api/checkout_sessions/${sessionId}` : null, fetchGetJSON); return ( <> @@ -33,13 +29,9 @@ const StripeCheckPaymentBanner = (props: Props) => { } relative w-full flex flex-row justify-start sm:justify-center items-center py-1 bg-gray-100 dark:bg-zinc-700`} >
- {t("payment.self")}{" "} - {data?.payment_intent?.status ?? t("common.loading")} + {t("payment.self")} {data?.payment_intent?.status ?? t("common.loading")}
-
diff --git a/src/components/SubscriptionHistoryTable.tsx b/src/components/SubscriptionHistoryTable.tsx index 9734dbb..eceaf1e 100644 --- a/src/components/SubscriptionHistoryTable.tsx +++ b/src/components/SubscriptionHistoryTable.tsx @@ -1,9 +1,9 @@ -import { useEffect, useState } from "react"; import axios from "axios"; +import { t } from "i18next"; import { useSession } from "next-auth/react"; +import { useEffect, useState } from "react"; import { SubscriptionPurchase } from "@/types"; import { getCurrencySymbol, getDateString } from "@/utils"; -import { t } from "i18next"; const SubscriptionHistoryTable = () => { const [list, setList] = useState([]); @@ -28,6 +28,10 @@ const SubscriptionHistoryTable = () => { } }, [session]); + if (list.length === 0) { + return <>; + } + return (
@@ -36,28 +40,16 @@ const SubscriptionHistoryTable = () => { - - - - + @@ -66,21 +58,13 @@ const SubscriptionHistoryTable = () => { + -
+ {t("common.date")} + {t("common.description")} + {t("common.amount")}
{getDateString(subscription.createdAt)} {subscription.description} - {subscription.description} - - {getCurrencySymbol( - subscription.currency.toLocaleUpperCase() - )} + {getCurrencySymbol(subscription.currency.toLocaleUpperCase())} {subscription.amount / 100} - + {t("setting.billing.view-receipt")}