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 fetchInbound({ queryKey }: { queryKey: [string, number] }): Promise<HostType> {
6 return fetch(`/inbounds/${queryKey[1]}`);
7}
8
9export const HostQueryFetchKey = "inbounds";
10
11export const useHostQuery = ({ inboundId }: { inboundId: number }) => {
12 return useQuery({
13 queryKey: [HostQueryFetchKey, inboundId],
14 queryFn: fetchInbound,
15 initialData: undefined
16 })
17}