♻️refactor

This commit is contained in:
Fred KISSIE
2025-11-17 22:17:55 +01:00
parent 2466d24c1a
commit 83f36bce9d
2 changed files with 22 additions and 11 deletions

View File

@@ -0,0 +1,20 @@
import { build } from "@server/build";
import { TierId } from "@server/lib/billing/tiers";
import { cache } from "react";
import { getCachedSubscription } from "./getCachedSubscription";
import type { GetOrgTierResponse } from "@server/routers/billing/types";
export const isSubscribed = cache(async (orgId: string) => {
let subscriptionStatus: GetOrgTierResponse | null = null;
try {
const subRes = await getCachedSubscription(orgId);
subscriptionStatus = subRes.data.data;
} catch {}
const subscribed =
build === "enterprise"
? true
: subscriptionStatus?.tier === TierId.STANDARD;
return subscribed;
});