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>;
}
