Conditional retry
This commit is contained in:
parent
386472e680
commit
f6a10c8133
File diff suppressed because one or more lines are too long
2
exam/dist/index.html
vendored
2
exam/dist/index.html
vendored
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>GuestBook</title>
|
<title>GuestBook</title>
|
||||||
<script type="module" crossorigin src="/phpCourse/exam/dist/assets/index-4tvMRi1p.js"></script>
|
<script type="module" crossorigin src="/phpCourse/exam/dist/assets/index-DBCDWqoJ.js"></script>
|
||||||
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/react-C9_qfvjK.js">
|
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/react-C9_qfvjK.js">
|
||||||
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/mui-BnAUJOoN.js">
|
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/mui-BnAUJOoN.js">
|
||||||
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/tanstack-BqkrhB-y.js">
|
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/tanstack-BqkrhB-y.js">
|
||||||
|
|||||||
2
exam/dist/stats.html
vendored
2
exam/dist/stats.html
vendored
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "react",
|
"name": "react",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { queryOptions } from '@tanstack/react-query';
|
import { queryOptions } from '@tanstack/react-query';
|
||||||
import { useApi } from '../api/Api';
|
import { useApi } from '../api/Api';
|
||||||
|
import { ERRORS } from '../components/Error/Errors';
|
||||||
|
|
||||||
export const profileSelfQueryOptions = (Api: ReturnType<typeof useApi>) =>
|
export const profileSelfQueryOptions = (Api: ReturnType<typeof useApi>) =>
|
||||||
queryOptions({
|
queryOptions({
|
||||||
@ -8,12 +9,12 @@ export const profileSelfQueryOptions = (Api: ReturnType<typeof useApi>) =>
|
|||||||
user: await Api.user(),
|
user: await Api.user(),
|
||||||
posts: await Api.userPosts(Api.authenticatedUser?.id ?? 0),
|
posts: await Api.userPosts(Api.authenticatedUser?.id ?? 0),
|
||||||
}),
|
}),
|
||||||
retry: false,
|
retry: (count, error) => ('code' in error && error.code !== ERRORS.UNAUTHORIZED ? count < 3 : false),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const profileQueryOptions = (Api: ReturnType<typeof useApi>, id?: number) =>
|
export const profileQueryOptions = (Api: ReturnType<typeof useApi>, id?: number) =>
|
||||||
queryOptions({
|
queryOptions({
|
||||||
queryKey: ['profile', { id }],
|
queryKey: ['profile', { id }],
|
||||||
queryFn: async () => ({ user: await Api.user(id), posts: await Api.userPosts(id) }),
|
queryFn: async () => ({ user: await Api.user(id), posts: await Api.userPosts(id) }),
|
||||||
retry: false,
|
retry: (count, error) => ('code' in error && error.code !== ERRORS.UNAUTHORIZED ? count < 3 : false),
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user