Skip to content

Commit

Permalink
Merge branch 'main' into fix/area-select
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund authored Jan 4, 2024
2 parents 7a2aba8 + 0dcaa3e commit cd441a3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/pages/ModelPages/Compute/ComputeObject/ComputeObject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as Styled from '../Compute.styled';
import { CaseInfoTyoe } from '../ComputeVariogram/ComputeVariogram';

export const ComputeObject = () => {
const [refetchKey, setRefetchKey] = useState<number>(0);
const [showAlert, setAlert] = useState<string>();
const { modelId } = useParams<{ modelId: string }>();
const { instance, accounts } = useMsal();
Expand All @@ -31,8 +32,12 @@ export const ComputeObject = () => {
setAlert('New object case saved');
};

const uppdateCaseList = () => {
setRefetchKey(refetchKey + 1);
};

const { data } = useQuery({
queryKey: ['model-cases', modelId],
queryKey: ['model-cases', modelId, refetchKey],
queryFn: () =>
AnalogueModelComputeCasesService.getApiAnalogueModelsComputeCases(
modelId as string,
Expand Down Expand Up @@ -79,7 +84,10 @@ export const ComputeObject = () => {

const res = await computeObject.mutateAsync(requestBody);

if (res.success) setAlert('Started computing case');
if (res.success) {
uppdateCaseList();
setAlert('Started computing case');
}
};

// Returnerer Cases fra DB
Expand Down

0 comments on commit cd441a3

Please sign in to comment.