import { useQuery } from '@tanstack/react-query' import { topBar } from '../../services/services' import queryKeys from '../../services/queryKeys' export default function TopBar() { // const topBarData = useMutation({ // mutationFn: (reqData) => { // return topBar(reqData) // }, // onError: (error) => { // console.log(error) // }, // onSuccess: (res) => { // if(res?.data?.resultCode != '0'){ // throw({message: 'Something went wrong'}) // } // } // }) // useEffect(()=>{ // let reqData = { // token: localStorage.getItem('token'), // USER TOKEN // uid: localStorage.getItem('uid') // USER UID // } // topBarData.mutate(reqData) // },[]) let reqData = { token: localStorage.getItem('token'), // USER TOKEN uid: localStorage.getItem('uid') // USER UID } const {data:topBarData, isFetching, isError, error} = useQuery({ queryKey: queryKeys.topBar, queryFn: () => topBar(reqData) }) const data = topBarData?.data?.top_bar // top bar data return ( <> {isFetching ? <>
Loading...
{error.message}