diff --git a/src/client/Containers/Calculation/index.jsx b/src/client/Containers/Calculation/index.jsx
index 7c4cc2b..f5d13da 100644
--- a/src/client/Containers/Calculation/index.jsx
+++ b/src/client/Containers/Calculation/index.jsx
@@ -1,37 +1,46 @@
+import { Spin } from 'antd';
import { useStores } from 'client/hooks/useStores';
import CalculationService from 'client/services/CalculationService';
import { Box, Flex } from 'client/UIKit/grid';
-import React, { useEffect } from 'react';
+import initialOptionsMap from 'core/Data/initialOptionsMap';
+import React, { useEffect, useState } from 'react';
import Results from './Results';
import Sections from './Sections';
-import initialOptionsMap from 'core/Data/initialOptionsMap';
const Calculation = () => {
+ const [ready, setReady] = useState(false);
const { calculationStore } = useStores();
useEffect(() => {
- CalculationService.getInitialOptions({
- elementsList: initialOptionsMap,
- })
- .then(options => {
- calculationStore.applyOptions({ ...options });
- })
- .catch(err => {
- throw err;
- });
-
- CalculationService.getEntityOptions({
- entityName: 'lead',
- fields: undefined,
- where: undefined,
- })
- .then(leadOptions => {
+ Promise.all([
+ CalculationService.getInitialOptions({
+ elementsList: initialOptionsMap,
+ }),
+ CalculationService.getEntityOptions({
+ entityName: 'lead',
+ fields: undefined,
+ where: undefined,
+ }),
+ ])
+ .then(([initialOptions, leadOptions]) => {
+ calculationStore.applyOptions({ ...initialOptions });
calculationStore.applyOptions({ selectLead: leadOptions });
+ setReady(true);
})
.catch(err => {
throw err;
});
}, []);
+ if (!ready) {
+ return (
+
+
+
+
+
+ );
+ }
+
return (