update: referral rewards don't trigger on free trials

This commit is contained in:
John Yeo
2025-04-17 11:44:59 +01:00
parent ebb2fcbfc6
commit 9cf9e263ac
16 changed files with 360 additions and 44 deletions

View File

@@ -3,7 +3,6 @@
import { Autumn } from "@/sdk/autumn";
export const getReferralCode = async (customerId: string) => {
console.log("Getting referral code");
const autumn = new Autumn();
const referralCode = await autumn.referrals.createCode({
customerId,

View File

@@ -53,15 +53,11 @@ const useCustomer = (customerId: string) => {
export default function ReferralsPage() {
const { referralCode, isLoading } = useReferralCode("ayush");
const {
entitlements,
refresh,
isLoading: isCustomerLoading,
} = useCustomer("ayush");
const { entitlements } = useCustomer("ayush");
let referrerId = "ayush";
let referee1Id = "john";
let [referral1Code, setReferral1Code] = useState<string>("");
const referrerId = "ayush";
const referee1Id = "john";
const [referral1Code, setReferral1Code] = useState<string>("");
return (
<div className="min-h-screen bg-zinc-50 p-8">
@@ -156,6 +152,7 @@ export default function ReferralsPage() {
toast.error("Something went wrong");
}
} catch (error) {
console.log("Failed to redeem code", error);
toast.error("Failed to redeem code");
}
}}