diff --git a/js/components/ascribe_forms/form.js b/js/components/ascribe_forms/form.js index 9aa6b84f..f5cfdbf7 100644 --- a/js/components/ascribe_forms/form.js +++ b/js/components/ascribe_forms/form.js @@ -63,7 +63,6 @@ let Form = React.createClass({ if ('getFormData' in this.props){ data = mergeOptionsWithDuplicates(data, this.props.getFormData()); } - console.log(data) return data; }, diff --git a/js/components/ascribe_forms/form_register_piece.js b/js/components/ascribe_forms/form_register_piece.js index 4b3ebe81..fa17bb0f 100644 --- a/js/components/ascribe_forms/form_register_piece.js +++ b/js/components/ascribe_forms/form_register_piece.js @@ -2,18 +2,21 @@ import React from 'react'; -import AppConstants from '../../constants/application_constants'; +import UserStore from '../../stores/user_store'; +import UserActions from '../../actions/user_actions'; import Form from './form'; import Property from './property'; import FormPropertyHeader from './form_property_header'; -import apiUrls from '../../constants/api_urls'; - import ReactS3FineUploader from '../ascribe_uploader/react_s3_fine_uploader'; +import AppConstants from '../../constants/application_constants'; +import apiUrls from '../../constants/api_urls'; + import { getCookie } from '../../utils/fetch_api_utils'; import { getLangText } from '../../utils/lang_utils'; +import { mergeOptions } from '../../utils/general_utils'; let RegisterPieceForm = React.createClass({ @@ -33,10 +36,26 @@ let RegisterPieceForm = React.createClass({ }, getInitialState(){ - return { - digitalWorkKey: null, - isUploadReady: false - }; + return mergeOptions( + { + digitalWorkKey: null, + isUploadReady: false + }, + UserStore.getState() + ); + }, + + componentDidMount() { + UserStore.listen(this.onChange); + UserActions.fetchCurrentUser(); + }, + + componentWillUnmount() { + UserStore.unlisten(this.onChange); + }, + + onChange(state) { + this.setState(state); }, getFormData(){ @@ -67,6 +86,9 @@ let RegisterPieceForm = React.createClass({ }, render() { + let currentUser = this.state.currentUser; + let enableLocalHashing = currentUser && currentUser.profile ? currentUser.profile.hash_locally : false; + return (