mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-02 16:49:40 -05:00
15 lines
611 B
TypeScript
15 lines
611 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { QueryKeys } from "../enums/query-keys";
|
|
import { createApi, createPublicApi } from "./queries/functions/api";
|
|
|
|
export const usePublicApi = () => useQuery({
|
|
queryKey: [QueryKeys.PublicApi],
|
|
queryFn: createPublicApi
|
|
});
|
|
|
|
export const useApi = (serverUrl?: string, username?: string, password?: string, accessToken?: string) => useQuery({
|
|
queryKey: [QueryKeys.Api, serverUrl, username, password, accessToken],
|
|
queryFn: ({ queryKey }) => createApi(serverUrl, username, password, accessToken),
|
|
gcTime: 1000,
|
|
refetchInterval: false
|
|
}) |