summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/pages
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-07 20:13:30 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-08 10:53:23 +0200
commit02a2f0f89cb1f39a5f8856bca1971a4e1b12374f (patch)
treedcea2fb2f46f47b0f5a961a52023510d227b5936 /opendc-web/opendc-web-ui/src/pages
parent9c8a987556d0fb0cdf0eb67e0c191a8dcc5593b9 (diff)
ui: Use React Query defaults to reduce duplication
Diffstat (limited to 'opendc-web/opendc-web-ui/src/pages')
-rw-r--r--opendc-web/opendc-web-ui/src/pages/_app.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/opendc-web/opendc-web-ui/src/pages/_app.js b/opendc-web/opendc-web-ui/src/pages/_app.js
index 7b4dcb3e..6a7200d5 100644
--- a/opendc-web/opendc-web-ui/src/pages/_app.js
+++ b/opendc-web/opendc-web-ui/src/pages/_app.js
@@ -30,11 +30,21 @@ import * as Sentry from '@sentry/react'
import { Integrations } from '@sentry/tracing'
import { QueryClient, QueryClientProvider } from 'react-query'
import { useMemo } from 'react'
+import { configureProjectClient } from '../data/project'
+import { configureExperimentClient } from '../data/experiments'
+import { configureTopologyClient } from '../data/topology'
// This setup is necessary to forward the Auth0 context to the Redux context
const Inner = ({ Component, pageProps }) => {
const auth = useAuth()
- const queryClient = useMemo(() => new QueryClient(), [])
+
+ const queryClient = useMemo(() => {
+ const client = new QueryClient()
+ configureProjectClient(client, auth)
+ configureExperimentClient(client, auth)
+ configureTopologyClient(client, auth)
+ return client
+ }, []) // eslint-disable-line react-hooks/exhaustive-deps
const store = useStore(pageProps.initialReduxState, { auth, queryClient })
return (
<QueryClientProvider client={queryClient}>