From 6b5b27ff6d368f27278dad0dc52f850ac2b5fd83 Mon Sep 17 00:00:00 2001 From: Mathias Oppedal Heggelund <98742460+mheggelund@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:00:28 +0100 Subject: [PATCH] Fix/refresh (#220) * fix: test rewrite router * fix: test rewrite app, index, layout, router order --- src/App.tsx | 7 ++++--- src/index.tsx | 7 +++---- src/router.tsx | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 966b588e..56bc52e4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,12 +1,13 @@ +import { InteractionType } from '@azure/msal-browser'; import { AuthenticatedTemplate, UnauthenticatedTemplate, useMsalAuthentication, } from '@azure/msal-react'; -import { InteractionType } from '@azure/msal-browser'; -import { Layout } from './pages/Layout'; +import { RouterProvider } from 'react-router-dom'; import { OpenAPI } from './api/generated'; import { apiConfig } from './auth/authConfig'; +import { router } from './router'; export function App() { useMsalAuthentication(InteractionType.Redirect); @@ -15,7 +16,7 @@ export function App() { return ( <> - +
You are not authorized
diff --git a/src/index.tsx b/src/index.tsx index cf733975..88c51c0b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,14 +1,13 @@ import { MsalProvider } from '@azure/msal-react'; import { QueryClientProvider } from '@tanstack/react-query'; +import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import React from 'react'; import ReactDOM from 'react-dom/client'; -import { RouterProvider } from 'react-router-dom'; +import { App } from './App'; import { msalInstance } from './auth/msalClient'; import { queryClient } from './auth/queryClient'; import './index.css'; import reportWebVitals from './reportWebVitals'; -import { router } from './router'; -import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; const root = ReactDOM.createRoot( document.getElementById('root') as HTMLElement, @@ -17,7 +16,7 @@ root.render( - + diff --git a/src/router.tsx b/src/router.tsx index d4d77f34..122d689d 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -1,10 +1,11 @@ import { createBrowserRouter } from 'react-router-dom'; -import { App } from './App'; + import { ModelView } from './features/ModelView/ModelView'; import { About } from './pages/About/About'; import { Api } from './pages/Api/Api'; import { Browse } from './pages/Browse/Browse'; import { InvalidURL } from './pages/InvalidURL/InvalidURL'; +import { Layout } from './pages/Layout'; import { ComputeObject } from './pages/ModelPages/Compute/ComputeObject/ComputeObject'; import { ComputeVariogram } from './pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram'; import { Model } from './pages/ModelPages/Model/Model'; @@ -14,7 +15,8 @@ import { VariogramResults } from './pages/ModelPages/Results/VariogramResults/Va const router = createBrowserRouter([ { path: '/', - element: , + element: , + children: [ { index: true,