.
This commit is contained in:
1 parent
905bbcc6dd
commit
2472f865ad
14 files changed
+825
-18
No files matched your search
@@ -5,11 +5,14 @@ import type {
|
||||
ApiAuction,
|
||||
ApiCommunity,
|
||||
ApiMatch,
|
||||
DdragonManifest,
|
||||
MatchStatus,
|
||||
MatchesResponse,
|
||||
MeResponse,
|
||||
} from './types';
|
||||
|
||||
const DDRAGON_MANIFEST_STALE_MS = 24 * 60 * 60 * 1000;
|
||||
|
||||
interface MatchesQueryOptions {
|
||||
status?: MatchStatus;
|
||||
limit?: number;
|
||||
@@ -74,6 +77,20 @@ export function useAuction(
|
||||
});
|
||||
}
|
||||
|
||||
export function useDdragonManifest(locale = 'ko_KR') {
|
||||
return useQuery({
|
||||
queryKey: ['ddragon-manifest', locale],
|
||||
queryFn: () =>
|
||||
apiFetch<DdragonManifest>(
|
||||
`/riot/ddragon/manifest?locale=${encodeURIComponent(locale)}`,
|
||||
),
|
||||
staleTime: DDRAGON_MANIFEST_STALE_MS,
|
||||
gcTime: DDRAGON_MANIFEST_STALE_MS,
|
||||
refetchOnMount: false,
|
||||
refetchOnReconnect: false,
|
||||
});
|
||||
}
|
||||
|
||||
export function useMe() {
|
||||
const authUserId = useAuthUserId();
|
||||
|
||||
|
||||
@@ -220,3 +220,11 @@ export interface MeResponse {
|
||||
export interface MatchesResponse {
|
||||
matches: ApiMatch[];
|
||||
}
|
||||
|
||||
export interface DdragonManifest {
|
||||
version: string;
|
||||
cdn: string;
|
||||
locale: string;
|
||||
champions: Record<string, string>;
|
||||
fetchedAt: string;
|
||||
}
|
||||
Reference in new issue
Block a user