diff --git a/src/client/Components/Result.tsx b/src/client/Components/Result.jsx similarity index 59% rename from src/client/Components/Result.tsx rename to src/client/Components/Result.jsx index f56f83e..fd883dd 100644 --- a/src/client/Components/Result.tsx +++ b/src/client/Components/Result.jsx @@ -4,3 +4,7 @@ import { Result, Button } from 'antd'; export const NotFound = () => ( ); + +export const ServerError = () => ( + +); diff --git a/src/client/Containers/Calculation/index.jsx b/src/client/Containers/Calculation/index.jsx index 7f63c44..9f53fe0 100644 --- a/src/client/Containers/Calculation/index.jsx +++ b/src/client/Containers/Calculation/index.jsx @@ -1,4 +1,5 @@ import { Spin } from 'antd'; +import { ServerError } from 'client/Components/Result'; import Modal from 'client/Elements/Modal'; import { withStoreModal } from 'client/hocs/withStore'; import { useStores } from 'client/hooks/useStores'; @@ -11,6 +12,7 @@ import Sections from './Sections'; const Calculation = () => { const [ready, setReady] = useState(false); + const [error, setError] = useState(undefined); const { calculationStore } = useStores(); useEffect(() => { Promise.all([ @@ -29,11 +31,12 @@ const Calculation = () => { setReady(true); }) .catch(err => { + setError(err); throw err; }); }, []); - if (!ready) { + if (!error && !ready) { return ( @@ -43,6 +46,10 @@ const Calculation = () => { ); } + if (error) { + return ; + } + const ModalComponent = withStoreModal(Modal); return (