UI to prevent suspended users viewing the application

This commit is contained in:
Jori Lallo
2018-03-04 22:18:23 -08:00
parent 1c2b3e992e
commit 1a8ca20fce
8 changed files with 49 additions and 9 deletions

View File

@ -1,6 +1,6 @@
// @flow
import React from 'react';
import { Switch, Route, withRouter } from 'react-router-dom';
import { Switch, Route, Redirect, withRouter } from 'react-router-dom';
import type { Location } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import styled from 'styled-components';
@ -17,6 +17,7 @@ import Sidebar from 'components/Sidebar';
import SettingsSidebar from 'components/Sidebar/Settings';
import Modals from 'components/Modals';
import Toasts from 'components/Toasts';
import ErrorSuspended from 'scenes/ErrorSuspended';
import AuthStore from 'stores/AuthStore';
import UiStore from 'stores/UiStore';
@ -66,11 +67,17 @@ class Layout extends React.Component {
this.props.ui.setActiveModal('keyboard-shortcuts');
}
renderSuspended() {
return <ErrorSuspended />;
}
render() {
const { auth, ui } = this.props;
const { user, team } = auth;
const showSidebar = auth.authenticated && user && team;
if (auth.isSuspended) return this.renderSuspended();
return (
<Container column auto>
<Helmet>