"use client"; import React, { useState } from "react"; import { getLocation } from "@/utils/CitizenReport"; import { useQuery } from "@tanstack/react-query"; import { ThreeDots } from "react-loader-spinner"; const OnMapRequests = () => { const { data: LocationData, isLoading, isError, isSuccess, refetch, } = useQuery({ queryKey: ["Location"], queryFn: () => getLocation(), refetchOnWindowFocus: false, }); if (isSuccess) { console.log(LocationData?.locations[0].locations); const fetchedContent = LocationData?.locations[0].locations; console.log(fetchedContent); } return ( <> {isLoading ? (
) : (

Map On

)} {isError &&

Map Failed

} ); }; export default OnMapRequests;