diff options
Diffstat (limited to 'public/bundle.js')
| -rw-r--r-- | public/bundle.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/public/bundle.js b/public/bundle.js index 9f503eb..d347c49 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -12045,6 +12045,7 @@ var App = function (_React$Component) { loggedIn: false, user: {} }; + _this.didAuthenticate = _this.didAuthenticate.bind(_this); _client2.default.authenticate().then(function (user) { _this.setState({ ready: true, @@ -12059,6 +12060,15 @@ var App = function (_React$Component) { } _createClass(App, [{ + key: 'didAuthenticate', + value: function didAuthenticate(user) { + console.log(user); + this.setState({ + user: user, + loggedIn: true + }); + } + }, { key: 'logOut', value: function logOut() { this.setState({ @@ -12073,7 +12083,7 @@ var App = function (_React$Component) { if (this.state.loggedIn) { return _react2.default.createElement(_LoggedInView2.default, { user: this.state.user }); } else { - return _react2.default.createElement(_LoggedOutView2.default, null); + return _react2.default.createElement(_LoggedOutView2.default, { didAuthenticate: this.didAuthenticate }); } } else { return _react2.default.createElement( @@ -12288,10 +12298,12 @@ var LoggedOutView = function (_React$Component) { if (this.state.modal == 'login') { return _react2.default.createElement(LoginForm, { visible: true, + didAuthenticate: this.props.didAuthenticate, onClose: this.closeModal }); } else if (this.state.modal == 'signup') { return _react2.default.createElement(SignupForm, { visible: true, + didAuthenticate: this.props.didAuthenticate, onClose: this.closeModal }); } else { return _react2.default.createElement(Welcome, { @@ -12382,7 +12394,7 @@ var LoginForm = function (_React$Component3) { password: this.state.password }).then(function (res) { console.log('Authenticated!', res); - window.location.reload(); + _this4.props.didAuthenticate(res.data); }).catch(function (error) { console.error('Error authenticating!', error); _this4.setState({ @@ -12472,7 +12484,7 @@ var SignupForm = function (_React$Component4) { }); }).then(function (res) { console.log('Authenticated!', res); - window.location.reload(); + _this6.props.didAuthenticate(res.data); }).catch(function (error) { console.error('Error authenticating!', error); _this6.setState({ |
