Skip to content

Commit

Permalink
Fix/refresh (#220)
Browse files Browse the repository at this point in the history
* fix: test rewrite router

* fix: test rewrite app, index, layout, router order
  • Loading branch information
mheggelund authored Jan 31, 2024
1 parent dcc5a47 commit 6b5b27f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -15,7 +16,7 @@ export function App() {
return (
<>
<AuthenticatedTemplate>
<Layout />
<RouterProvider router={router} />
</AuthenticatedTemplate>
<UnauthenticatedTemplate>
<div>You are not authorized</div>
Expand Down
7 changes: 3 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -17,7 +16,7 @@ root.render(
<React.StrictMode>
<MsalProvider instance={msalInstance}>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
<App />
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
</MsalProvider>
Expand Down
6 changes: 4 additions & 2 deletions src/router.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -14,7 +15,8 @@ import { VariogramResults } from './pages/ModelPages/Results/VariogramResults/Va
const router = createBrowserRouter([
{
path: '/',
element: <App />,
element: <Layout />,

children: [
{
index: true,
Expand Down

0 comments on commit 6b5b27f

Please sign in to comment.