mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-08 03:49:59 -06:00
getting api client to get added to context when signed in Server name should stay on auth screen even when a different server address is requested
17 lines
493 B
TypeScript
17 lines
493 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { QueryKeys } from "../enums/query-keys";
|
|
import { createApi, createPublicApi } from "./queries/functions/api";
|
|
|
|
export const usePublicApi = (serverUrl: string) => useQuery({
|
|
queryKey: [QueryKeys.PublicApi, serverUrl],
|
|
queryFn: ({ queryKey }) => {
|
|
createPublicApi(queryKey[1])
|
|
}
|
|
})
|
|
|
|
export const useApi = () => useQuery({
|
|
queryKey: [QueryKeys.Api],
|
|
queryFn: async () => {
|
|
return createApi();
|
|
}
|
|
}) |