MCPcopy Create free account
hub / github.com/dailydotdev/apps / onAuthError

Function onAuthError

packages/shared/src/contexts/BootProvider.tsx:277–290  ·  view source on GitHub ↗
(err: ApiErrorResult)

Source from the content-addressed store, hash-verified

275 // subscribe to auth errors of queries and mutations and in case token
276 // expired at the time of error refetch boot to get the new one
277 const onAuthError = (err: ApiErrorResult) => {
278 if (
279 !getApiError(err, ApiError.Forbidden) &&
280 !getApiError(err, ApiError.Unauthenticated)
281 ) {
282 return;
283 }
284
285 const expiresIn = remoteData?.accessToken?.expiresIn;
286
287 if (expiresIn && new Date(expiresIn) < new Date()) {
288 debouncedRefetch();
289 }
290 };
291
292 const unsubscribeQueries = queryClient
293 .getQueryCache()

Callers 1

BootDataProviderFunction · 0.85

Calls 1

getApiErrorFunction · 0.90

Tested by

no test coverage detected