refactor: add apikey check before setup

This commit is contained in:
moonrailgun 2024-10-04 01:44:17 +08:00
parent 74d391afc1
commit f0ddf6c5dd

View File

@ -7,10 +7,12 @@ import {
import { env } from '../utils/env.js';
import { prisma } from './_client.js';
lemonSqueezySetup({
apiKey: env.billing.lemonSqueezy.apiKey,
onError: (error) => console.error('Error!', error),
});
if (env.billing.lemonSqueezy.apiKey) {
lemonSqueezySetup({
apiKey: env.billing.lemonSqueezy.apiKey,
onError: (error) => console.error('Error!', error),
});
}
export type SubscriptionTierType =
keyof typeof env.billing.lemonSqueezy.tierVariantId;