From 2abdf56c1e8621cd6402ba526cdee535997bcfff Mon Sep 17 00:00:00 2001 From: xn1cklas Date: Sun, 8 Sep 2024 10:16:05 +0200 Subject: [PATCH] chore: improve file and function names --- src/app/actions/checkout.tsx | 4 ++-- src/app/page.tsx | 4 ++-- src/components/{Products.tsx => fetch-products.ts} | 4 ++-- src/utils/{PolarClient.tsx => polar-client.ts} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename src/components/{Products.tsx => fetch-products.ts} (74%) rename src/utils/{PolarClient.tsx => polar-client.ts} (100%) diff --git a/src/app/actions/checkout.tsx b/src/app/actions/checkout.tsx index 0226b49..bb62a38 100644 --- a/src/app/actions/checkout.tsx +++ b/src/app/actions/checkout.tsx @@ -1,16 +1,16 @@ "use server"; -import { polar } from "@/utils/PolarClient"; +import { polar } from "@/utils/polar-client"; import { redirect } from "next/navigation"; export async function checkout({ productPriceId, + successUrl, }: { productPriceId: string | undefined; successUrl: string; }) { "use server"; - const successUrl = "https://trained-technologist.com"; if (!productPriceId) { redirect(successUrl); diff --git a/src/app/page.tsx b/src/app/page.tsx index e682c6a..2743ea4 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,8 +1,8 @@ +import { fetchProducts } from "@/components/fetch-products"; import { Pricing } from "@/components/Pricing"; -import { Products } from "@/components/Products"; export default async function Page() { - const products = await Products(); + const products = await fetchProducts(); return (
diff --git a/src/components/Products.tsx b/src/components/fetch-products.ts similarity index 74% rename from src/components/Products.tsx rename to src/components/fetch-products.ts index 113876a..1d9455d 100644 --- a/src/components/Products.tsx +++ b/src/components/fetch-products.ts @@ -1,7 +1,7 @@ -import { polar } from "@/utils/PolarClient"; +import { polar } from "@/utils/polar-client"; import { ProductOutput } from "@polar-sh/sdk/models/components"; -export async function Products(): Promise { +export async function fetchProducts(): Promise { try { const result = await polar.products.list({ organizationId: process.env.NEXT_PUBLIC_POLAR_ORGANIZATION_ID, diff --git a/src/utils/PolarClient.tsx b/src/utils/polar-client.ts similarity index 100% rename from src/utils/PolarClient.tsx rename to src/utils/polar-client.ts