aah/client/pages/Service.tsx

16 lines
451 B
TypeScript
Raw Permalink Normal View History

2023-08-07 23:36:33 +00:00
import { useQuery } from "react-query";
import { getService } from "../lib/api";
import { useParams } from "react-router";
export default function Service() {
const { id } = useParams();
const serviceQuery = useQuery(["service/get", id], () => getService(id));
if (serviceQuery.status !== "success") {
console.log("SHIET", serviceQuery);
return <>Loading...</>;
}
return <pre>{JSON.stringify(serviceQuery.data, null, 2)}</pre>;
}