diff --git a/src/features/ModelView/ModelMetadataView/ModelMetadataView.tsx b/src/features/ModelView/ModelMetadataView/ModelMetadataView.tsx index 3da9488f..27f99ee1 100644 --- a/src/features/ModelView/ModelMetadataView/ModelMetadataView.tsx +++ b/src/features/ModelView/ModelMetadataView/ModelMetadataView.tsx @@ -2,6 +2,7 @@ import { useMsal } from '@azure/msal-react'; import { Button, Table, Typography } from '@equinor/eds-core-react'; import { useQuery } from '@tanstack/react-query'; import { useParams } from 'react-router-dom'; +import { OpenAPI } from '../../../api/generated'; import { AnalogueModelsService } from '../../../api/generated/services/AnalogueModelsService'; import { useAccessToken } from '../../../hooks/useAccessToken'; @@ -12,6 +13,7 @@ export const ModelMetadataView = () => { const { modelId } = useParams(); const { instance, accounts } = useMsal(); const token = useAccessToken(instance, accounts[0]); + if (token) OpenAPI.TOKEN = token; const { isLoading, data } = useQuery({ queryKey: ['analogue-models', modelId], @@ -21,9 +23,6 @@ export const ModelMetadataView = () => { }); if (isLoading || !data?.success) return

Loading ...

; - // TODO - // Map rows to model data - return (
Description and metadata diff --git a/src/features/ModelView/ModelSourceView/ModelSourceView.tsx b/src/features/ModelView/ModelSourceView/ModelSourceView.tsx index e5c93fc2..bb53d86c 100644 --- a/src/features/ModelView/ModelSourceView/ModelSourceView.tsx +++ b/src/features/ModelView/ModelSourceView/ModelSourceView.tsx @@ -2,13 +2,18 @@ import { useMsal } from '@azure/msal-react'; import { Table, Typography } from '@equinor/eds-core-react'; import { useQuery } from '@tanstack/react-query'; import { useParams } from 'react-router-dom'; -import { AnalogueModelsService, UploadList } from '../../../api/generated'; +import { + AnalogueModelsService, + OpenAPI, + UploadList, +} from '../../../api/generated'; import { useAccessToken } from '../../../hooks/useAccessToken'; export const ModelSourceView = () => { const { modelId } = useParams(); const { instance, accounts } = useMsal(); const token = useAccessToken(instance, accounts[0]); + if (token) OpenAPI.TOKEN = token; const { isLoading, data } = useQuery({ queryKey: ['analogue-models', modelId], diff --git a/src/pages/ModelPages/Model/Model.tsx b/src/pages/ModelPages/Model/Model.tsx index 0ac97ea1..62855637 100644 --- a/src/pages/ModelPages/Model/Model.tsx +++ b/src/pages/ModelPages/Model/Model.tsx @@ -1,7 +1,7 @@ import { useMsal } from '@azure/msal-react'; import { useQuery } from '@tanstack/react-query'; import { Outlet, useParams } from 'react-router-dom'; -import { AnalogueModelsService } from '../../../api/generated'; +import { AnalogueModelsService, OpenAPI } from '../../../api/generated'; import { ModelNameFrame } from '../../../features/ModelView/ModelNameFrame/ModelNameFrame'; import { ModelNavigationBar } from '../../../features/ModelView/ModelNavigationBar/ModelNavigationBar'; import { useAccessToken } from '../../../hooks/useAccessToken'; @@ -11,6 +11,7 @@ export const Model = () => { const { modelId } = useParams<{ modelId: string }>(); const { instance, accounts } = useMsal(); const token = useAccessToken(instance, accounts[0]); + if (token) OpenAPI.TOKEN = token; const { data, isLoading } = useQuery({ queryKey: ['analogue-models', modelId],