File tree Expand file tree Collapse file tree 5 files changed +7
-8
lines changed Expand file tree Collapse file tree 5 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import { CheckIcon } from "./CheckIcon" ;
4
4
import clsx from "clsx" ;
5
+ import { useAccount } from "wagmi" ;
5
6
import { useFetchUserData } from "~~/hooks/useFetchUserData" ;
6
7
7
8
export function ChallengeHeading ( { challengeId } : { challengeId : number } ) {
8
- const { userData } = useFetchUserData ( ) ;
9
+ const { address } = useAccount ( ) ;
10
+ const { userData } = useFetchUserData ( { address } ) ;
9
11
10
12
const isCaptured = userData ?. challenges ?. items . some ( challenge => Number ( challenge . challengeId ) === challengeId ) ;
11
13
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export const HeaderClient = ({ menuLinks }: { menuLinks: ReactNode }) => {
26
26
27
27
const { address : connectedAddress } = useAccount ( ) ;
28
28
29
- const { userData } = useFetchUserData ( ) ;
29
+ const { userData } = useFetchUserData ( { address : connectedAddress } ) ;
30
30
31
31
const flagsCaptured = userData ?. challenges ?. items . length || 0 ;
32
32
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export function HeroInvaders() {
17
17
const [ rowThreeMove , setRowThreeMove ] = useState ( "translate-x-0" ) ;
18
18
19
19
const { address : connectedAddress } = useAccount ( ) ;
20
- const { hasCompletedChallenge1 } = useFetchUserData ( ) ;
20
+ const { hasCompletedChallenge1 } = useFetchUserData ( { address : connectedAddress } ) ;
21
21
22
22
useEffect ( ( ) => {
23
23
const interval = setInterval ( ( ) => {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { useFetchUserData } from "~~/hooks/useFetchUserData";
8
8
import { getFormattedDateTime } from "~~/utils/date" ;
9
9
10
10
export const UserData = ( { address, challenges } : { address : string ; challenges : string [ ] } ) => {
11
- const { userData } = useFetchUserData ( ) ;
11
+ const { userData } = useFetchUserData ( { address } ) ;
12
12
13
13
if ( ! userData ) {
14
14
return (
Original file line number Diff line number Diff line change 2
2
3
3
import { useQuery } from "@tanstack/react-query" ;
4
4
import { gql , request } from "graphql-request" ;
5
- import { useAccount } from "wagmi" ;
6
5
import { UsersData } from "~~/types/utils" ;
7
6
8
7
const fetchUser = async ( userId : string ) => {
@@ -33,9 +32,7 @@ const fetchUser = async (userId: string) => {
33
32
return data ;
34
33
} ;
35
34
36
- export const useFetchUserData = ( ) => {
37
- const { address } = useAccount ( ) ;
38
-
35
+ export const useFetchUserData = ( { address } : { address ?: string } ) => {
39
36
const { data, isLoading, isError } = useQuery < UsersData > ( {
40
37
queryKey : [ "user" , address ] ,
41
38
queryFn : ( ) => fetchUser ( address || "" ) ,
You can’t perform that action at this time.
0 commit comments