https://dev.kronoz.win/r/marzneshin.git
1import { NodeType } from "@marzneshin/features/nodes";
2import { useQuery } from "@tanstack/react-query";
3import { fetch } from "@marzneshin/utils";
4
5export async function fetchNodes(): Promise<NodeType[]> {
6 return fetch('/nodes').then((result) => {
7 return result.items;
8 });
9}
10
11export const NodesQueryFetchKey = "nodes";
12
13export const useNodesQuery = () => {
14 return useQuery({
15 queryKey: [NodesQueryFetchKey],
16 queryFn: fetchNodes,
17 initialData: []
18 })
19}