mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-11-04 17:35:15 +00:00
18 lines
476 B
TypeScript
18 lines
476 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { getStreams, type HostExpansion, type Stream } from "src/api/backend";
|
|
|
|
const fetchStreams = (expand?: HostExpansion[]) => {
|
|
return getStreams(expand);
|
|
};
|
|
|
|
const useStreams = (expand?: HostExpansion[], options = {}) => {
|
|
return useQuery<Stream[], Error>({
|
|
queryKey: ["streams", { expand }],
|
|
queryFn: () => fetchStreams(expand),
|
|
staleTime: 60 * 1000,
|
|
...options,
|
|
});
|
|
};
|
|
|
|
export { fetchStreams, useStreams };
|