Add part of Map Section , Revoke
parent
5bbfdb3945
commit
c72118e030
|
|
@ -1,9 +1,51 @@
|
||||||
import React from 'react'
|
"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 OnMapRequests = () => {
|
||||||
return (
|
const {
|
||||||
<div>OnMapRequests</div>
|
data: LocationData,
|
||||||
)
|
isLoading,
|
||||||
}
|
isError,
|
||||||
|
isSuccess,
|
||||||
|
refetch,
|
||||||
|
} = useQuery({
|
||||||
|
queryKey: ["Location"],
|
||||||
|
queryFn: () => getLocation(),
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
});
|
||||||
|
|
||||||
export default OnMapRequests
|
if (isSuccess) {
|
||||||
|
console.log(LocationData?.locations[0].locations);
|
||||||
|
const fetchedContent = LocationData?.locations[0].locations;
|
||||||
|
console.log(fetchedContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{isLoading ? (
|
||||||
|
<div className="flex justify-center text-center w-36">
|
||||||
|
<ThreeDots
|
||||||
|
visible={true}
|
||||||
|
height="50"
|
||||||
|
width="50"
|
||||||
|
color="#003778"
|
||||||
|
radius="9"
|
||||||
|
ariaLabel="three-dots-loading"
|
||||||
|
wrapperStyle={{}}
|
||||||
|
wrapperClass=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="flex justify-center items-center gap-2 text-center ">
|
||||||
|
<p>Map On</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isError && <p>Map Failed</p>}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default OnMapRequests;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,42 @@
|
||||||
import React from "react";
|
"use client";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
import OnMapRequests from "./OnMapRequests";
|
import OnMapRequests from "./OnMapRequests";
|
||||||
import AllRequests from "./AllRequests";
|
import AllRequests from "./AllRequests";
|
||||||
import NearestRequests from "./NearestRequests";
|
import NearestRequests from "./NearestRequests";
|
||||||
import { TabRequests } from "./TabRequests";
|
import { TabRequests } from "./TabRequests";
|
||||||
// import UserContainer from "../User/UserContainer";
|
// import UserContainer from "../User/UserContainer";
|
||||||
|
// import { useRouter } from "next/navigation";
|
||||||
|
// import { useMutation } from "@tanstack/react-query";
|
||||||
|
// import { revoke } from "@/utils/authenticateApi";
|
||||||
|
// import { deleteCookie, getCookie } from "cookies-next";
|
||||||
|
|
||||||
function RecentRequests() {
|
function RecentRequests() {
|
||||||
|
// const router = useRouter();
|
||||||
|
|
||||||
|
// const revokeMutation = useMutation({
|
||||||
|
// mutationFn: revoke,
|
||||||
|
// onSuccess: (res) => {},
|
||||||
|
// onError: (err: any | string) => {},
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const logout = () => {
|
||||||
|
// revokeMutation.mutate({
|
||||||
|
// refreshToken: getCookie("Shahrbin_Refresh_Token"),
|
||||||
|
// });
|
||||||
|
// // saveToken(false);
|
||||||
|
// deleteCookie("Shahrbin_Refresh_Token");
|
||||||
|
// deleteCookie("Shahrbin_Token");
|
||||||
|
// router.push("/");
|
||||||
|
// };
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// if (!getCookie("Shahrbin_Token")) {
|
||||||
|
// logout();
|
||||||
|
// }
|
||||||
|
// }, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="w-full flex flex-1 flex-row gap-8 overflow-hidden bg-white p-[10px]">
|
<section className="w-full flex flex-1 flex-row gap-8 overflow-hidden bg-white p-[10px]">
|
||||||
|
|
||||||
{/* Right */}
|
{/* Right */}
|
||||||
<div className="w-full rounded-md bg-rose-100">
|
<div className="w-full rounded-md bg-rose-100">
|
||||||
<div id="map" aria-label="نقشه">
|
<div id="map" aria-label="نقشه">
|
||||||
|
|
@ -26,7 +54,6 @@ function RecentRequests() {
|
||||||
</div> */}
|
</div> */}
|
||||||
|
|
||||||
<TabRequests />
|
<TabRequests />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { CookieValueTypes } from "cookies-next";
|
||||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||||
// axios.defaults.baseURL = "https://shahrbinapi.shetabdahi.ir/";
|
// axios.defaults.baseURL = "https://shahrbinapi.shetabdahi.ir/";
|
||||||
|
|
||||||
// Get Captcha
|
// Get Location
|
||||||
export async function getLocation() {
|
export async function getLocation() {
|
||||||
const data = await axios.get(`/api/CitizenReport/Locations`, {
|
const data = await axios.get(`/api/CitizenReport/Locations`, {
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue