-
+
+
diff --git a/src/Pages/Privacy/Page.tsx b/src/Pages/Privacy/Page.tsx
index 7bca360..afec429 100644
--- a/src/Pages/Privacy/Page.tsx
+++ b/src/Pages/Privacy/Page.tsx
@@ -1,18 +1,17 @@
import Info from "../../Components/Info/Info"
-import { useGetHome } from "../../api/home";
-import { PrivacyData } from "../../data/Info"
+import { useFetchData } from "../../Hooks/useFetchData";
const Page = () => {
- const {data} = useGetHome();
- console.log(data?.Static_info);
-
+ const { data, isLoading } = useFetchData('api/home');
+
const privacyData = data?.Static_info[2];
return (
-
+
)
}
diff --git a/src/Pages/Projects/Page.tsx b/src/Pages/Projects/Page.tsx
index f422fc9..e8035ee 100644
--- a/src/Pages/Projects/Page.tsx
+++ b/src/Pages/Projects/Page.tsx
@@ -1,16 +1,14 @@
import { IoIosArrowDroprightCircle } from "react-icons/io";
import AnimationButton from "../../Components/Ui/AnimationButton";
import HeaderLink from "../../Components/Ui/HeaderLink"
-import { ProjectsArray } from "../../data/Projects";
import ProjectCard from "../../Components/Projects/ProjectCard";
-import { useGetProject } from "../../api/project";
import Spinner from "../../Components/Utils/Loading/Spinner";
+import { useFetchData } from "../../Hooks/useFetchData";
const Page = () => {
const {t} = useTranslation();
- const {data ,isLoading} = useGetProject();
- console.log(data);
- // const projectData = data?.
+ const { data, isLoading} = useFetchData('api/project');
+
return (
diff --git a/src/Pages/Services/Page.tsx b/src/Pages/Services/Page.tsx
index 0cde1d6..a9da5f3 100644
--- a/src/Pages/Services/Page.tsx
+++ b/src/Pages/Services/Page.tsx
@@ -1,12 +1,13 @@
import Service from '../../Components/Service/Service'
+import { useFetchData } from '../../Hooks/useFetchData';
import { useGetHome } from '../../api/home';
const Services = () => {
- const {data} = useGetHome();
+ const { data, isLoading } = useFetchData('api/home');
return (
<>
-
+
>
)
}
diff --git a/src/Pages/SingleProject/Page.tsx b/src/Pages/SingleProject/Page.tsx
index 5c56936..c703372 100644
--- a/src/Pages/SingleProject/Page.tsx
+++ b/src/Pages/SingleProject/Page.tsx
@@ -3,16 +3,16 @@ import { useParams } from 'react-router-dom';
import { IoIosArrowDroprightCircle } from "react-icons/io";
import AnimationButton from "../../Components/Ui/AnimationButton";
import HeaderLink from "../../Components/Ui/HeaderLink";
-import { useGetProject } from '../../api/project';
import { BaseURL_IMAGE } from '../../api/config';
import Spinner from '../../Components/Utils/Loading/Spinner';
import ReactPlayer from 'react-player';
+import { useFetchData } from '../../Hooks/useFetchData';
const SingleProjectPage = () => {
const { id } = useParams<{ id: string }>();
- const { data, isLoading } = useGetProject();
+ const { data, isLoading} = useFetchData('api/project');
+
const [playing, setPlaying] = useState(false);
-
const project = data?.find((p: { id: { toString: () => string | undefined; }; }) => p.id.toString() === id);
const handlePlayPause = () => {
diff --git a/src/Pages/Terms/Page.tsx b/src/Pages/Terms/Page.tsx
index 867fd14..40f5141 100644
--- a/src/Pages/Terms/Page.tsx
+++ b/src/Pages/Terms/Page.tsx
@@ -1,15 +1,16 @@
import Info from "../../Components/Info/Info"
-import { useGetHome } from "../../api/home";
+import { useFetchData } from "../../Hooks/useFetchData";
const Page = () => {
- const {data} = useGetHome();
-
+ const { data, isLoading } = useFetchData('api/home');
+
const TermsData = data?.Static_info[1];
return (
-
)
}
diff --git a/src/api/home.ts b/src/api/home.ts
index 1dc79ba..5f11cc3 100644
--- a/src/api/home.ts
+++ b/src/api/home.ts
@@ -1,7 +1,7 @@
import useGetQuery from "./helper/useGetQuery"
const API = {
- GET:"/api/home",
+ GET:"api/home",
}
const KEY = "Home"
diff --git a/src/api/project.ts b/src/api/project.ts
index 51b7a4d..bc21bda 100644
--- a/src/api/project.ts
+++ b/src/api/project.ts
@@ -1,7 +1,7 @@
import useGetQuery from "./helper/useGetQuery"
const API = {
- GET:"/api/project",
+ GET:"api/project",
}
const KEY = "PROJECT"
diff --git a/src/lib/ReactQueryProvider.tsx b/src/lib/ReactQueryProvider.tsx
index 72e68d4..7989b53 100644
--- a/src/lib/ReactQueryProvider.tsx
+++ b/src/lib/ReactQueryProvider.tsx
@@ -3,7 +3,15 @@ import { QueryClient, QueryClientProvider } from 'react-query'
function QueryProvider({ children }: any) {
- const queryClient = new QueryClient()
+ const queryClient = new QueryClient({
+ defaultOptions: {
+ queries: {
+ refetchOnWindowFocus:false,
+ cacheTime:Infinity,
+ staleTime: Infinity,
+ },
+ },
+ })
return (
diff --git a/src/type/InfoProps.ts b/src/type/InfoProps.ts
index b914747..162bf7b 100644
--- a/src/type/InfoProps.ts
+++ b/src/type/InfoProps.ts
@@ -2,4 +2,5 @@ export interface InfoProps{
headerText:string,
title:string,
response:string,
+ isLoading:boolean
}
\ No newline at end of file