From df7486333b223b70de9d84cda67fd44be1fd54cb Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Thu, 19 Apr 2018 13:06:08 -0400 Subject: [PATCH] allow login screen to be skipped for test repo demos --- src/backends/test-repo/AuthenticationPage.js | 12 ++++++++++++ src/components/App/App.js | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/backends/test-repo/AuthenticationPage.js b/src/backends/test-repo/AuthenticationPage.js index b9becaa1..799e645a 100644 --- a/src/backends/test-repo/AuthenticationPage.js +++ b/src/backends/test-repo/AuthenticationPage.js @@ -1,4 +1,5 @@ import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; import React from 'react'; import { Icon } from 'UI'; @@ -6,8 +7,19 @@ export default class AuthenticationPage extends React.Component { static propTypes = { onLogin: PropTypes.func.isRequired, inProgress: PropTypes.bool, + config: ImmutablePropTypes.map.isRequired, }; + componentWillMount() { + /** + * Allow login screen to be skipped for demo purposes. + */ + const skipLogin = this.props.config.getIn(['backend', 'login']) === false; + if (skipLogin) { + this.props.onLogin(this.state); + } + } + handleLogin = (e) => { e.preventDefault(); this.props.onLogin(this.state); diff --git a/src/components/App/App.js b/src/components/App/App.js index 6dcf11be..1613e59d 100644 --- a/src/components/App/App.js +++ b/src/components/App/App.js @@ -83,7 +83,8 @@ class App extends React.Component { error: auth && auth.get('error'), isFetching: auth && auth.get('isFetching'), siteId: this.props.config.getIn(["backend", "site_domain"]), - base_url: this.props.config.getIn(["backend", "base_url"], null) + base_url: this.props.config.getIn(["backend", "base_url"], null), + config: this.props.config, }) }