Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 1x 1x 1x 1x 1x | import { useParams } from "react-router-dom";
import { useQuery } from "react-query";
import PublisherSettingsForm from "./PublisherSettingsForm";
import { setPageTitle } from "../../utils";
import Loader from "../../components/Loader";
function PublisherSettings() {
const { snapId } = useParams();
const { data, isLoading, isFetched } = useQuery({
queryKey: ["settingsData", snapId],
queryFn: async () => {
const response = await fetch(`/api/${snapId}/settings`);
if (!response.ok) {
throw new Error("There was a problem fetching settings data");
}
const data = await response.json();
return data.data;
},
});
setPageTitle(`Settings for ${snapId}`);
return (
<>
{isLoading && <Loader />}
{!isLoading && isFetched && data && (
<PublisherSettingsForm settings={data} />
)}
</>
);
}
export default PublisherSettings;
|