From 28a1c8f2d42088306809356c4d9339d24d6e8183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 3 Jun 2015 11:49:39 +0200 Subject: [PATCH] fix modal undefined bug --- js/actions/user_actions.js | 2 +- .../ascribe_buttons/acl_button_list.js | 59 ++++++++++--------- .../ascribe_media/resource_viewer.js | 1 - js/components/ascribe_modal/modal_wrapper.js | 3 +- js/components/header.js | 8 ++- js/mixins/form_mixin.js | 4 +- js/stores/user_store.js | 6 +- 7 files changed, 44 insertions(+), 39 deletions(-) diff --git a/js/actions/user_actions.js b/js/actions/user_actions.js index 34e80f52..46f63539 100644 --- a/js/actions/user_actions.js +++ b/js/actions/user_actions.js @@ -15,7 +15,7 @@ class UserActions { this.actions.updateCurrentUser(res['users'][0]); }) .catch((err) => { - console.log(err); + console.log(err); }); } }; diff --git a/js/components/ascribe_buttons/acl_button_list.js b/js/components/ascribe_buttons/acl_button_list.js index 45118707..d2f60a1e 100644 --- a/js/components/ascribe_buttons/acl_button_list.js +++ b/js/components/ascribe_buttons/acl_button_list.js @@ -14,41 +14,44 @@ let AclButtonList = React.createClass({ this.setState(state); }, - componentWillMount() { - UserActions.fetchCurrentUser(); + componentDidMount() { UserStore.listen(this.onChange); + UserActions.fetchCurrentUser(); }, componentDidUnmount() { UserStore.unlisten(this.onChange); }, + render() { - return (
- - - - -
) + return ( +
+ + + + +
+ ); } }); diff --git a/js/components/ascribe_media/resource_viewer.js b/js/components/ascribe_media/resource_viewer.js index 4519bcb7..e15e8480 100644 --- a/js/components/ascribe_media/resource_viewer.js +++ b/js/components/ascribe_media/resource_viewer.js @@ -25,7 +25,6 @@ let ResourceViewer = React.createClass({ mixins: [InjectInHeadMixin], componentDidMount() { - this.inject('http://antani.com'); }, render() { diff --git a/js/components/ascribe_modal/modal_wrapper.js b/js/components/ascribe_modal/modal_wrapper.js index a5d20389..600d2667 100644 --- a/js/components/ascribe_modal/modal_wrapper.js +++ b/js/components/ascribe_modal/modal_wrapper.js @@ -19,8 +19,7 @@ let ModalWrapper = React.createClass({ title={this.props.title} editions={this.props.editions} currentUser={this.props.currentUser} - handleSuccess={this.props.handleSuccess} - > + handleSuccess={this.props.handleSuccess}> {this.props.children} }> diff --git a/js/components/header.js b/js/components/header.js index b7a412e0..b52f35b4 100644 --- a/js/components/header.js +++ b/js/components/header.js @@ -22,8 +22,12 @@ let Header = React.createClass({ }, componentDidMount() { - UserStore.listen(this.onChange) UserActions.fetchCurrentUser(); + UserStore.listen(this.onChange) + }, + + componentDidUnmount() { + UserStore.unlisten(this.onChange) }, onChange(state) { @@ -40,7 +44,7 @@ let Header = React.createClass({