mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-25 17:53:48 +02:00
rewrite web request logging function
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { AppDebug, logWebRequest, withQueryLog } from '../services/appConfig';
|
||||
import { queryClient } from './client';
|
||||
import { queryKeys } from './keys';
|
||||
import { toQueryOptions } from './policies';
|
||||
@@ -151,10 +152,16 @@ export async function fetchWithEntityPolicy({ queryKey, policy, queryFn }) {
|
||||
|
||||
const data = await queryClient.fetchQuery({
|
||||
queryKey,
|
||||
queryFn,
|
||||
queryFn: () => withQueryLog(queryFn),
|
||||
...toQueryOptions(policy)
|
||||
});
|
||||
|
||||
if (isFresh) {
|
||||
logWebRequest('[QUERY CACHE HIT]', queryKey, data);
|
||||
} else {
|
||||
logWebRequest('[QUERY FETCH]', queryKey, data);
|
||||
}
|
||||
|
||||
return {
|
||||
data,
|
||||
cache: isFresh
|
||||
|
||||
Reference in New Issue
Block a user