From 0f79ef34c98c9fd99aea5b1c2dc9255dce9cc011 Mon Sep 17 00:00:00 2001 From: Jennifer Echenim Date: Sat, 28 Sep 2024 05:36:55 +0400 Subject: [PATCH] rm unused general service file --- packages/ui/api/general.ts | 13 +------------ packages/ui/services/useGeneralService.ts | 23 ----------------------- 2 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 packages/ui/services/useGeneralService.ts diff --git a/packages/ui/api/general.ts b/packages/ui/api/general.ts index edbbbdbcbc..721cb819be 100644 --- a/packages/ui/api/general.ts +++ b/packages/ui/api/general.ts @@ -1,17 +1,6 @@ -import { httpRequest } from "."; import { siteMetadata } from "../../../tools/bridge-frontend/src/lib/siteMetadata"; -import { DocumentInterface, ResponseDataInterface } from "../lib/types/common"; -import { apiRoutes } from "../routes"; -import { pathToUrl } from "../routes/router"; +import { DocumentInterface } from "../lib/types/common"; -export const fetchTestnetStatus = async (): Promise< - ResponseDataInterface -> => { - return await httpRequest>({ - method: "get", - url: pathToUrl(apiRoutes.getHealthStatus), - }); -}; export const fetchDocument = async (id: string): Promise => { const response = await fetch(`/docs/${id}.json`); const data = await response.json(); diff --git a/packages/ui/services/useGeneralService.ts b/packages/ui/services/useGeneralService.ts deleted file mode 100644 index 2577ac0487..0000000000 --- a/packages/ui/services/useGeneralService.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { useQuery } from "@tanstack/react-query"; -import { fetchDocument, fetchTestnetStatus } from "../api/general"; - -export const useGeneralService = () => { - const { data: testnetStatus, isLoading: isStatusLoading } = useQuery({ - queryKey: ["testnetStatus"], - queryFn: () => fetchTestnetStatus(), - refetchInterval: 10000, - }); - - return { - testnetStatus, - isStatusLoading, - }; -}; - -export const useDocumentService = (id: string | undefined) => { - return useQuery({ - queryKey: ["document", id], - queryFn: () => fetchDocument(id || ""), - enabled: !!id, - }); -};