optimize: skip has getSubscription request if user has no subscriptions
This commit is contained in:
parent
047a9b1956
commit
1c669f04dd
@ -14,14 +14,15 @@ import Link from 'next/link';
|
||||
|
||||
export default async function ProPage() {
|
||||
const { telegramId } = await getSessionUser();
|
||||
const { hasActiveSubscription } = await getSubscription({
|
||||
telegramId,
|
||||
});
|
||||
|
||||
const { subscriptions } = await getSubscriptions({
|
||||
filters: { customer: { telegramId: { eq: telegramId } } },
|
||||
});
|
||||
|
||||
const hasActiveSubscription = subscriptions?.length
|
||||
? ((await getSubscription({ telegramId }))?.hasActiveSubscription ?? false)
|
||||
: false;
|
||||
|
||||
const canUseTrial = !subscriptions?.length;
|
||||
|
||||
const { subscriptionPrices = [] } = await getSubscriptionPrices({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user