69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
"use client";
|
|
import React, { useEffect, useState } from "react";
|
|
import OnMapRequests from "./OnMapRequests";
|
|
import AllRequests from "./AllRequests";
|
|
import NearestRequests from "./NearestRequests";
|
|
import { TabRequests } from "./TabRequests";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import { getInstances } from "@/utils/CitizenCommon";
|
|
import dynamic from 'next/dynamic'
|
|
// import UserContainer from "../User/UserContainer";
|
|
// import { useRouter } from "next/navigation";
|
|
// import { useMutation } from "@tanstack/react-query";
|
|
// import { deleteCookie, getCookie } from "cookies-next";
|
|
|
|
|
|
const ComponentMap = dynamic(() => import('./OnMapRequests'), { ssr: false })
|
|
|
|
function RecentRequests() {
|
|
const [citizenInstance, setCitizenInstance] = useState<any | null>(null);
|
|
|
|
// const router = useRouter();
|
|
const {
|
|
data: instancesData,
|
|
isLoading,
|
|
isError,
|
|
isSuccess,
|
|
refetch,
|
|
} = useQuery({
|
|
queryKey: ["Instances"],
|
|
queryFn: () => getInstances(),
|
|
refetchOnWindowFocus: false,
|
|
});
|
|
|
|
useEffect(() => {
|
|
if (instancesData) {
|
|
console.log(instancesData);
|
|
console.log(instancesData?.data);
|
|
console.log(instancesData?.data[0]);
|
|
localStorage.setItem("SH_CT_INSTANCE",JSON.stringify(instancesData?.data[0]));
|
|
}
|
|
}, [isSuccess]);
|
|
|
|
return (
|
|
<section className="w-full flex flex-1 flex-row gap-8 overflow-hidden bg-white p-[10px]">
|
|
{/* Right */}
|
|
<div className="w-full rounded-md bg-rose-100">
|
|
<div id="map" aria-label="نقشه">
|
|
{/* <OnMapRequests /> */}
|
|
{/* <ComponentMap /> */}
|
|
</div>
|
|
</div>
|
|
|
|
{/* Left */}
|
|
<div className="w-full rounded-md">
|
|
{/* <div id="all" aria-label="همه">
|
|
<AllRequests />
|
|
</div>
|
|
<div id="nearest" aria-label="نزدیکترینها">
|
|
<NearestRequests />
|
|
</div> */}
|
|
|
|
<TabRequests />
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|
|
|
|
export default RecentRequests;
|