https://dev.kronoz.win/r/marzneshin.git
1import { HostType } from "@marzneshin/modules/hosts";
2import { useQuery } from "@tanstack/react-query";
3import { fetch } from "@marzneshin/common/utils";
4
5export async function fetchHost({ queryKey }: { queryKey: [string, number] }): Promise<HostType> {
6 return fetch(`/inbounds/hosts/${queryKey[1]}`);
7}
8
9export const HostQueryFetchKey = "hosts";
10
11export const useHostQuery = ({ hostId }: { hostId: number }) => {
12 return useQuery({
13 queryKey: [HostQueryFetchKey, hostId],
14 queryFn: fetchHost,
15 initialData: undefined
16 })
17}