'use strict'; import { h, render, Component } from 'preact'; class LoginForm extends Component { constructor(props) { super(props) this.handleSubmit = this.handleSubmit.bind(this); this.setState({ email: '', password: '', }) } handleSubmit(e) { e.preventDefault(); fetch('/api/session', { method: "POST", data: { email: this.state.email, password: this.state.password, }, credentials: 'include' }).then((r) => { if( r.status == 200 ) { this.props.onAuth(); console.log("Authenticated!"); } // TODO: Handle errors }); } render() { return (

Login

Please enter your credentials to access your Ana dashboard.

) } } export default LoginForm