.
This commit is contained in:
1 parent
8b8dec4c44
commit
7a43a667f1
7 files changed
+201
-122
No files matched your search
@@ -6,6 +6,7 @@ import { apiFetch } from '../lib/api';
|
||||
import {
|
||||
isMsalConfigured,
|
||||
MSAL_API_SCOPE,
|
||||
MSAL_SILENT_REDIRECT_URI,
|
||||
} from '../lib/auth/msal.config';
|
||||
import type {
|
||||
ApiAuction,
|
||||
@@ -53,7 +54,8 @@ function createMatchesPath(
|
||||
export function useCommunity(communityId = DEFAULT_COMMUNITY_ID) {
|
||||
return useQuery({
|
||||
queryKey: ['community', communityId],
|
||||
queryFn: () => apiFetch<ApiCommunity>(`/communities/${communityId}`),
|
||||
queryFn: () =>
|
||||
apiFetch<ApiCommunity>(`/communities/${communityId}`, { auth: 'none' }),
|
||||
enabled: Boolean(communityId),
|
||||
});
|
||||
}
|
||||
@@ -67,6 +69,7 @@ export function useMatches(
|
||||
queryFn: async () => {
|
||||
const response = await apiFetch<MatchesResponse>(
|
||||
createMatchesPath(communityId, options),
|
||||
{ auth: 'none' },
|
||||
);
|
||||
return response.matches;
|
||||
},
|
||||
@@ -78,7 +81,9 @@ export function useMatch(matchId: string | undefined, communityId = DEFAULT_COMM
|
||||
return useQuery({
|
||||
queryKey: ['match', communityId, matchId ?? null],
|
||||
queryFn: () =>
|
||||
apiFetch<ApiMatch>(`/communities/${communityId}/matches/${matchId}`),
|
||||
apiFetch<ApiMatch>(`/communities/${communityId}/matches/${matchId}`, {
|
||||
auth: 'none',
|
||||
}),
|
||||
enabled: Boolean(communityId && matchId),
|
||||
retry: false,
|
||||
});
|
||||
@@ -91,7 +96,10 @@ export function useAuction(
|
||||
return useQuery({
|
||||
queryKey: ['auction', communityId, matchId ?? null],
|
||||
queryFn: () =>
|
||||
apiFetch<ApiAuction>(`/communities/${communityId}/matches/${matchId}/auction`),
|
||||
apiFetch<ApiAuction>(
|
||||
`/communities/${communityId}/matches/${matchId}/auction`,
|
||||
{ auth: 'none' },
|
||||
),
|
||||
enabled: Boolean(communityId && matchId),
|
||||
retry: false,
|
||||
});
|
||||
@@ -128,6 +136,7 @@ export function useUserHistoryProfile(
|
||||
queryFn: () =>
|
||||
apiFetch<ApiUserHistoryProfile>(
|
||||
`/communities/${communityId}/users/${userId}/history-profile`,
|
||||
{ auth: 'none' },
|
||||
),
|
||||
enabled: Boolean(communityId && userId),
|
||||
retry: false,
|
||||
@@ -151,6 +160,7 @@ export function useChampionStats(
|
||||
queryFn: () =>
|
||||
apiFetch<ApiChampionStatsResponse>(
|
||||
createUserHistoryPath(communityId, userId ?? '', 'champion-stats', filters),
|
||||
{ auth: 'none' },
|
||||
),
|
||||
enabled: Boolean(communityId && userId),
|
||||
});
|
||||
@@ -174,6 +184,7 @@ export function useRecentSummary(
|
||||
queryFn: () =>
|
||||
apiFetch<ApiRecentSummaryResponse>(
|
||||
createUserHistoryPath(communityId, userId ?? '', 'recent-summary', filters),
|
||||
{ auth: 'none' },
|
||||
),
|
||||
enabled: Boolean(communityId && userId),
|
||||
});
|
||||
@@ -200,6 +211,7 @@ export function useRecentMatches(
|
||||
cursor: pageParam,
|
||||
limit: 10,
|
||||
}),
|
||||
{ auth: 'none' },
|
||||
),
|
||||
initialPageParam: null as number | null,
|
||||
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
||||
@@ -232,6 +244,7 @@ export function useDdragonManifest(locale = 'ko_KR') {
|
||||
queryFn: () =>
|
||||
apiFetch<DdragonManifest>(
|
||||
`/riot/ddragon/manifest?locale=${encodeURIComponent(locale)}`,
|
||||
{ auth: 'none' },
|
||||
),
|
||||
staleTime: DDRAGON_MANIFEST_STALE_MS,
|
||||
gcTime: DDRAGON_MANIFEST_STALE_MS,
|
||||
@@ -260,6 +273,7 @@ export function useMe() {
|
||||
const response = await instance.acquireTokenSilent({
|
||||
account,
|
||||
scopes: [MSAL_API_SCOPE],
|
||||
redirectUri: MSAL_SILENT_REDIRECT_URI,
|
||||
});
|
||||
return apiFetch<MeResponse>('/me', {
|
||||
headers: {
|
||||
|
||||
Reference in new issue
Block a user