Classgen: refactor functions

This commit is contained in:
Johannes Kirschbauer
2024-07-19 15:09:46 +02:00
parent a7e3fd431d
commit 5c18f67fed
4 changed files with 216 additions and 120 deletions

View File

@@ -9,10 +9,11 @@ export const BlockDevicesView: Component = () => {
refetch: loadDevices,
isFetching,
} = createQuery(() => ({
queryKey: ["TanStack Query"],
queryKey: ["block_devices"],
queryFn: async () => {
const result = await callApi("show_block_devices", {});
if (result.status === "error") throw new Error("Failed to fetch data");
return result.data;
},
staleTime: 1000 * 60 * 5,

View File

@@ -34,7 +34,7 @@ export const Flash = () => {
refetch: loadDevices,
isFetching,
} = createQuery(() => ({
queryKey: ["TanStack Query"],
queryKey: ["block_devices"],
queryFn: async () => {
const result = await callApi("show_block_devices", {});
if (result.status === "error") throw new Error("Failed to fetch data");