auth0-extensions/auth0-sso-dashboard-extension

View on GitHub
client/containers/App.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';

import { logout } from '../actions/auth';
import { applicationActions, connectionActions, statusActions, groupsActions, authorizationActions } from '../actions';

import Header from '../components/Header';

class App extends Component {
  static propTypes = {
    user: PropTypes.object,
    issuer: PropTypes.string,
    logout: PropTypes.func
  };

  componentWillMount() {
    this.props.fetchStatus();
  }

  render() {
    return (
      <div>
        <Header user={this.props.user} issuer={this.props.issuer} onLogout={this.props.logout} isAdmin={this.props.isAdmin} />
        <div className="container">
          <div className="row">
            <section className="content-page current">
              <div className="col-xs-12">
                <div id="content-area" className="tab-content">
                  {this.props.children}
                </div>
              </div>
            </section>
          </div>
        </div>
      </div>
    );
  }
}

function select(state) {
  return {
    issuer: state.auth.get('issuer'),
    user: state.auth.get('user'),
    ruleStatus: state.ruleStatus,
    isAdmin: state.status.get('isAdmin')
  };
}

export default connect(select, { logout, ...applicationActions, ...connectionActions, ...statusActions, ...groupsActions, ...authorizationActions })(App);