💳 Support payments with Stripe (#822)

This commit is contained in:
Luke Vella 2023-08-23 15:29:40 +01:00 committed by GitHub
parent 969ae35971
commit 6f425edeaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 712 additions and 229 deletions

View file

@ -1,11 +1,9 @@
import { trpc } from "@rallly/backend";
export const usePlan = () => {
const { data } = trpc.user.getBilling.useQuery(undefined, {
staleTime: 10 * 1000,
});
const { data } = trpc.user.subscription.useQuery();
const isPaid = Boolean(data && data.endDate.getTime() > Date.now());
const isPaid = data?.active === true;
return isPaid ? "paid" : "free";
};