Skip to content

Commit

Permalink
Merge pull request #526 from us3r-network/F-claimBoarding-ttang
Browse files Browse the repository at this point in the history
feat: claim login check
  • Loading branch information
Tonyce authored Feb 7, 2024
2 parents 19234fb + bd50604 commit 0fe4cd3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/u3/src/hooks/social/farcaster/useFarcasterClaim.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
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,
msg: '',
});

const getClaimStatus = useCallback(async () => {
if (!isLogin) {
toast.error('Please login to check claim status');
return;
}
try {
const resp = await getClaimStatusApi();
const { data } = resp;
Expand All @@ -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;
Expand Down

0 comments on commit 0fe4cd3

Please sign in to comment.