Skip to content

Commit

Permalink
changed useTanstackuseQuery to useQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
saikiranpatil committed Dec 18, 2024
1 parent 33ae347 commit b9b0ed0
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/components/Facility/LocationManagement.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useQuery } from "@tanstack/react-query";
import { useState } from "react";

import RecordMeta from "@/CAREUI/display/RecordMeta";
Expand All @@ -19,6 +20,7 @@ import useAuthUser from "@/hooks/useAuthUser";
import AuthorizeFor, { NonReadOnlyUsers } from "@/Utils/AuthorizeFor";
import * as Notification from "@/Utils/Notifications";
import routes from "@/Utils/request/api";
import query from "@/Utils/request/query";
import request from "@/Utils/request/request";
import useTanStackQueryInstead from "@/Utils/request/useQuery";

Expand All @@ -45,19 +47,16 @@ export default function LocationManagement({ facilityId }: Props) {
name: "",
id: "",
});
const [facilityMiddleware, setFacilityMiddleware] = useState<
string | undefined
>(undefined);

useTanStackQueryInstead(routes.getPermittedFacility, {
pathParams: { id: facilityId },
onResponse: (res) => {
if (res.data) {
setFacilityMiddleware(res.data?.middleware_address);
}
},
const { data } = useQuery({
queryKey: [routes.getPermittedFacility.path, facilityId],
queryFn: query(routes.getPermittedFacility, {
pathParams: { id: facilityId },
}),
});

const facilityMiddleware = data?.middleware_address;

const closeDeleteFailModal = () => {
setShowDeleteFailModal({ ...showDeleteFailModal, open: false });
};
Expand Down

0 comments on commit b9b0ed0

Please sign in to comment.