'use strict'; import React from 'react'; import Router from 'react-router'; import GlobalNotificationModel from '../models/global_notification_model'; import GlobalNotificationActions from '../actions/global_notification_actions'; import UserStore from '../stores/user_store'; import UserActions from '../actions/user_actions'; import Form from './ascribe_forms/form'; import Property from './ascribe_forms/property'; import apiUrls from '../constants/api_urls'; import AppConstants from '../constants/application_constants'; let Link = Router.Link; let LoginContainer = React.createClass({ propTypes: { message: React.PropTypes.string, redirectOnLoggedIn: React.PropTypes.bool, redirectOnLoginSuccess: React.PropTypes.bool }, mixins: [Router.Navigation], getDefaultProps() { return { message: 'Log in to ascribe...', redirectOnLoggedIn: true, redirectOnLoginSuccess: true }; }, getInitialState() { return UserStore.getState(); }, componentDidMount() { UserStore.listen(this.onChange); }, componentWillUnmount() { UserStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); // if user is already logged in, redirect him to piece list if(this.state.currentUser && this.state.currentUser.email && this.props.redirectOnLoggedIn) { this.transitionTo('pieces'); } }, render() { return (