import React from 'react'; import { Redirect } from 'react-router'; import { Input, Button, Container, Icon, Loader } from '../../components/'; import { Config, Admin } from '../../model/'; import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; export class LoginPage extends React.Component { constructor(props){ super(props); this.state = { loading: false, error: null }; } componentDidMount(){ this.refs.$input.ref.focus(); } authenticate(e){ e.preventDefault(); this.setState({loading: true}); Admin.login(this.refs.$input.ref.value) .then(() => this.props.reload()) .catch(() => { this.refs.$input.ref.value = ""; this.setState({ loading: false, error: true }, () => { window.setTimeout(() => { this.setState({error: false}); }, 500); }); }); } render(){ const marginTop = () => { return {marginTop: parseInt(window.innerHeight / 3)+'px'};}; return (
); } }