'use strict'; import { h, render, Component } from 'preact'; import Client from '../lib/client.js'; import Notification from '../components/Notification.js'; import { bind } from 'decko'; class LoginForm extends Component { constructor(props) { super(props) this.state = { email: '', password: '', message: '' } } @bind handleSubmit(e) { e.preventDefault(); this.setState({ message: '' }); Client.request('session', { method: "POST", data: { email: this.state.email, password: this.state.password, } }).then((r) => { this.props.onSuccess() }).catch((e) => { this.setState({ message: e.message, password: '' }); }); } @bind updatePassword(e) { this.setState({ password: e.target.value }); } @bind updateEmail(e) { this.setState({ email: e.target.value }); } render(props, state) { return (

Login

Please enter your login credentials to access your Fathom dashboard.

{(state.message ? : '')}
) } } export default LoginForm