content: import React, { Component } from 'react';
  import { Redirect, Route, Switch, withRouter } from 'react-router-dom';
  import { inject, observer } from 'mobx-react';
  import { Alert } from 'reactstrap';
  
  import Loading from '../components/loading';
  
  import Login from './auth/login';
  import Protected from './protected';
  
  @withRouter
  @inject('alertStore', 'authStore')
  @observer
  export default class Scenes extends Component {
      componentDidMount() {
          const { alertStore, authStore } = this.props;
  
          // authStore.authenticate()
          //     .then(response => alertStore.showSuccess(response.message))
          //     .catch(err => alertStore.showDanger(err.message));
      }
  
      render() {
          const { alertStore, authStore } = this.props;
  
          return (
              <div className="scenes--component">
                  {authStore.isLoading ?
                      <Loading/>
                      :
                      <Switch>
                          <Route
                              path="/login"
                              render={props => (
                                  authStore.isAuthenticated ?
                                      <Redirect to={{
                                          pathname: '/',
                                          state: {
                                              from: props.location,
                                          },
                                      }}/>
                                      :
                                      <Login {...props}/>
                              )}/>
  
                          <Route
                              path="/"
                              render={props => (
                                  authStore.isAuthenticated ?
                                      <Protected {...props}/>
                                      :
                                      <Redirect to={{
                                          pathname: '/login',
                                          state: {
                                              from: props.location,
                                          },
                                      }}/>
                              )}/>
                      </Switch>
                  }
  
                  <div style={{ position: 'fixed', right: '15px', bottom: 0, zIndex: 1000 }}>
                      <Alert color={alertStore.type} isOpen={alertStore.isOpen} toggle={alertStore.hide}>
                          <div style={{ paddingRight: '30px' }}>{alertStore.message}</div>
                      </Alert>
                  </div>
              </div>
          );
      }
  }
  