mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-13 02:53:50 +00:00
feat(#32): Strongly type the price.type
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user