Created components to display errors when loading a server

This commit is contained in:
Alejandro Celaya
2020-03-08 12:37:55 +01:00
parent febecab33c
commit d1a5ee43e9
6 changed files with 62 additions and 15 deletions

View File

@@ -7,6 +7,7 @@ import classNames from 'classnames';
import * as PropTypes from 'prop-types';
import { serverType } from '../servers/prop-types';
import Message from '../utils/Message';
import { ServerError } from '../servers/helpers/ServerError';
import NotFound from './NotFound';
import './MenuLayout.scss';
@@ -32,16 +33,11 @@ const MenuLayout = (TagsList, ShortUrls, AsideMenu, CreateShortUrl, ShortUrlVisi
}
if (selectedServer.serverNotFound) {
return <Message type="error">Could not find this Shlink server in this host.</Message>;
return <ServerError type="not-found" />;
}
if (selectedServer.serverNotReachable) {
return (
<Message type="error">
<p>Oops! Could not connect to this Shlink server.</p>
Make sure you have internet connection, and the server is properly configured and on-line.
</Message>
);
return <ServerError type="not-reachable" />;
}
const burgerClasses = classNames('menu-layout__burger-icon', {