feat(#32): Strongly type the price.type

This commit is contained in:
Josh Creek
2024-10-08 20:32:24 +01:00
parent 2f7ec9860a
commit e51aeb7c63
+2 -1
View File
@@ -1,5 +1,6 @@
import { json } from '@sveltejs/kit';
import { stripe as stripeClient } from '$lib/utils/stripe';
import Stripe from 'stripe';
export const GET = async ({ params }) => {
const { productId } = params;
@@ -7,7 +8,7 @@ export const GET = async ({ params }) => {
const price = await stripeClient.prices.retrieve(product.default_price);
const isSubscription = price.type === 'recurring';
const isSubscription = (price.type as Stripe.Price.type) === 'recurring';
product.isSubscription = isSubscription;
return json(product);
};