From bd506044da86aaeef056d44dc35c51a01b7e4fd2 Mon Sep 17 00:00:00 2001 From: ttang Date: Wed, 7 Feb 2024 08:56:35 +0800 Subject: [PATCH] feat: claim login check --- apps/u3/src/hooks/social/farcaster/useFarcasterClaim.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/u3/src/hooks/social/farcaster/useFarcasterClaim.ts b/apps/u3/src/hooks/social/farcaster/useFarcasterClaim.ts index ed590ea2..9a3ad003 100644 --- a/apps/u3/src/hooks/social/farcaster/useFarcasterClaim.ts +++ b/apps/u3/src/hooks/social/farcaster/useFarcasterClaim.ts @@ -1,8 +1,11 @@ +import { toast } from 'react-toastify'; import { useCallback, useEffect, useState } from 'react'; import { getClaimStatusApi } from '@/services/social/api/farcaster'; +import useLogin from '@/hooks/shared/useLogin'; export default function useFarcasterClaim({ currFid }: { currFid: number }) { const [mounted, setMounted] = useState(false); + const { isLogin } = useLogin(); const [claimStatus, setClaimStatus] = useState({ statusCode: 100, amount: 100, @@ -10,6 +13,10 @@ export default function useFarcasterClaim({ currFid }: { currFid: number }) { }); const getClaimStatus = useCallback(async () => { + if (!isLogin) { + toast.error('Please login to check claim status'); + return; + } try { const resp = await getClaimStatusApi(); const { data } = resp; @@ -22,7 +29,7 @@ export default function useFarcasterClaim({ currFid }: { currFid: number }) { } catch (e) { console.error('Error getting claim status', e); } - }, []); + }, [isLogin]); useEffect(() => { if (!mounted) return;