import React, {useEffect} from 'react' import { useMutation } from '@tanstack/react-query' import { topBar } from '../../services/services' 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) },[]) const data = topBarData?.data?.data?.top_bar // top bar data return ( <> {topBarData.isPending ? <>
Loading...
{topBarData.error.message}