refactor: replace useSWR with custom hooks for update and network interfaces (#6195)

This commit is contained in:
Tunglies
2026-01-27 12:52:20 +00:00
committed by GitHub
parent 36926df26c
commit c57a962109
8 changed files with 97 additions and 69 deletions
+22
View File
@@ -0,0 +1,22 @@
import useSWR from "swr";
import { getNetworkInterfacesInfo } from "@/services/cmds";
export const useNetworkInterfaces = () => {
const { data, error, isLoading, mutate } = useSWR(
"getNetworkInterfacesInfo",
getNetworkInterfacesInfo,
{
revalidateOnFocus: false,
revalidateOnReconnect: false,
fallbackData: [],
},
);
return {
networkInterfaces: data || [],
loading: isLoading,
error,
mutate,
};
};