Skip to content

Commit

Permalink
chore: Fetch model data.
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund committed Dec 13, 2023
1 parent 9f23dc6 commit 8d81517
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pages/ModelPages/Compute/ComputeObject/ComputeObject.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable max-lines-per-function */
import { Typography } from '@equinor/eds-core-react';
import { useMutation } from '@tanstack/react-query';
import { useMutation, useQuery } from '@tanstack/react-query';
import { useState } from 'react';
import { useParams } from 'react-router-dom';
import { AnalogueModelsService } from '../../../../api/generated';
import { EstimateChannelCommand } from '../../../../api/generated/models/EstimateChannelCommand';
import { JobsService } from '../../../../api/generated/services/JobsService';
import { CaseGroup } from '../../../../features/Compute/CaseGroup/CaseGroup';
Expand All @@ -15,6 +16,14 @@ import {
} from '../ComputeVariogram/ComputeVariogram';

export const ComputeObject = () => {
const { modelId } = useParams<{ modelId: string }>();

const { isLoading, data } = useQuery({
queryKey: ['analogue-models', modelId],
queryFn: () =>
AnalogueModelsService.getApiAnalogueModels1(modelId as string),
});

const [caseGroup, setCaseGroup] = useState<CaseGroupType[]>([
{
id: '1',
Expand All @@ -25,7 +34,6 @@ export const ComputeObject = () => {
const [cases, setCases] = useState<Casetype[]>([
{ id: '1', name: 'Channel' },
]);
const { modelId } = useParams<{ modelId: string }>();

const computeObject = useMutation({
mutationFn: JobsService.postApiJobsComputeChannelEstimations,
Expand Down Expand Up @@ -73,6 +81,8 @@ export const ComputeObject = () => {
await computeObject.mutateAsync(requestBody);
};

if (isLoading || !data?.success) return <p>Loading ...</p>;

return (
<Styled.Case>
<ComputeHeader addCase={addCase} caseInfo={ObjectCaseInfo} />
Expand Down

0 comments on commit 8d81517

Please sign in to comment.