Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43aeb40b20 |
+35
-1
@@ -1,10 +1,44 @@
|
|||||||
// удаляем все, оставляя лишь пустую функцию App ниже
|
import { useMutation, QueryClientProvider, QueryClient } from '@tanstack/react-query'
|
||||||
|
import PostAddForm from './components/PostAddForm'
|
||||||
|
|
||||||
|
/*
|
||||||
|
const mutation = useMutation({
|
||||||
|
mutationFn: newUser => {
|
||||||
|
fetch('https://jsonplaceholder.typicode.com/users', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {'Content-type':'application/json'},
|
||||||
|
body: JSON.stringify(newUser),
|
||||||
|
}).then(res => res.json())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
|
const createQueryClient = () => {
|
||||||
|
new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
staleTime: 5 * 60*1000,
|
||||||
|
retry: 1,
|
||||||
|
gcTime: 10*60*1000,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
retry:0,
|
||||||
|
onError: error => {console.error('Mutation error:',error.message)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Добавьте тестовый контент для проверки */}
|
{/* Добавьте тестовый контент для проверки */}
|
||||||
<h1>Hello, React!</h1>
|
<h1>Hello, React!</h1>
|
||||||
|
<QueryClientProvider client={createQueryClient}>
|
||||||
|
<PostAddForm />
|
||||||
|
</QueryClientProvider>
|
||||||
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user