show errors on connection?!
parent
5588f04b7e
commit
0214e0c86b
15
src/app.tsx
15
src/app.tsx
|
|
@ -36,6 +36,7 @@ const useMounted = () => {
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const [connected, setConnected] = useState(false);
|
const [connected, setConnected] = useState(false);
|
||||||
const [columns, rows] = useStdoutDimensions();
|
const [columns, rows] = useStdoutDimensions();
|
||||||
|
const [error, setError] = useState(null);
|
||||||
const { exit } = useApp();
|
const { exit } = useApp();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -51,6 +52,8 @@ const App = () => {
|
||||||
useUnifiedTopology: true
|
useUnifiedTopology: true
|
||||||
}).then(() => new Promise(res => setTimeout(res, 1000))).then(() => {
|
}).then(() => new Promise(res => setTimeout(res, 1000))).then(() => {
|
||||||
setConnected(true);
|
setConnected(true);
|
||||||
|
}).catch(e => {
|
||||||
|
setError(e);
|
||||||
})
|
})
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
@ -61,15 +64,19 @@ const App = () => {
|
||||||
height={rows}
|
height={rows}
|
||||||
width={columns}
|
width={columns}
|
||||||
>
|
>
|
||||||
{!connected &&
|
{(!connected) && (
|
||||||
<Box
|
<Box
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
width="100%"
|
width="100%"
|
||||||
>
|
>
|
||||||
<Text>Connecting to Task Database...</Text>
|
{(error) && (
|
||||||
|
<Text>{error.message}</Text>
|
||||||
|
) || (
|
||||||
|
<Text>Connecting to Task Database...</Text>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
||
|
) || (
|
||||||
<Multiview
|
<Multiview
|
||||||
screens={[
|
screens={[
|
||||||
{
|
{
|
||||||
|
|
@ -82,7 +89,7 @@ const App = () => {
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);;;
|
);;;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue