diff --git a/src/pages/give-vip/index.tsx b/src/pages/give-vip/index.tsx index 1efb795..2d62e47 100644 --- a/src/pages/give-vip/index.tsx +++ b/src/pages/give-vip/index.tsx @@ -22,6 +22,7 @@ enum State { export default function GiveVip() { const [state, setState] = useState(State.PENDING); const [expireAt, setExpireAt] = useState(''); + const [usedBefore, setUsedBefore] = useState(false); const handleNavigate = useCallback(() => { switchTab(PageUrl.Job); }, []); @@ -31,6 +32,7 @@ export default function GiveVip() { const code = getCouponCodeFromQuery(query); claimMembershipCoupon(code!) .then(res => { + setUsedBefore(res.usedBefore); setExpireAt(res.usageExpireAt); setState(Date.now() > new Date(res.usageExpireAt).getTime() ? State.FAILED : State.SUCCESS); }) @@ -46,7 +48,7 @@ export default function GiveVip() {
-
宝子,播络会员领取成功
+
{usedBefore ? '宝子,你已经领过了,下周再来' : '宝子,播络会员领取成功'}
diff --git a/src/types/coupon.ts b/src/types/coupon.ts index 5aa80c8..61e4dbe 100644 --- a/src/types/coupon.ts +++ b/src/types/coupon.ts @@ -1,5 +1,6 @@ export type ClaimMembershipCouponResponse = { code: string; + usedBefore: boolean; usageExpireAt: string; };