summaryrefslogtreecommitdiffstats
path: root/frontend/src/Login.js
diff options
context:
space:
mode:
authorJan Tuomi <jan.tuomi@eficode.com>2020-02-01 16:33:56 +0200
committerJan Tuomi <jan.tuomi@eficode.com>2020-02-01 16:33:56 +0200
commita5ae2653d8ccdaf00270c0c8c8a30b88d7955114 (patch)
treebd265901dbda512fb1f6d717beb545234468d7ec /frontend/src/Login.js
parentfbf108595a00a7c9db5984158e4b02cc345b68d1 (diff)
Do stuff
Diffstat (limited to 'frontend/src/Login.js')
-rw-r--r--frontend/src/Login.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/frontend/src/Login.js b/frontend/src/Login.js
index e30b496..1a1cb2b 100644
--- a/frontend/src/Login.js
+++ b/frontend/src/Login.js
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { useForm } from 'react-hook-form';
-import { navigate } from '@reach/router';
+import { navigate, Link } from '@reach/router';
import axios from './axios';
import userState from './UserState';
@@ -13,6 +13,7 @@ const Login = () => {
try {
const resp = await axios.post('/login', data);
const { username } = resp.data;
+ userState.authError = null;
userState.username = username;
navigate('/');
} catch (err) {
@@ -34,8 +35,14 @@ const Login = () => {
<label>
Password <input name="password" type="password" ref={register} required />
</label>
+ <label>
+ Remember me <input name="remember" type="checkbox" ref={register} />
+ </label>
<button type="submit">Log in</button>
<div className="error">{loginError}</div>
+ <div>
+ No account? Register <Link to="/register">here</Link>.
+ </div>
{/* <div className="error">{errors}</div> */}
</form>
);