fix login
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
// eslint-disable-next-line
|
||||
const preact = require('preact');
|
||||
const { useState } = require('preact/hooks');
|
||||
|
||||
function renderLogin({ submitLogin, submitRegister }) {
|
||||
const details = {
|
||||
name: '',
|
||||
password: '',
|
||||
};
|
||||
const [name, setName] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
|
||||
return (
|
||||
<div className="login">
|
||||
@@ -13,22 +12,22 @@ function renderLogin({ submitLogin, submitRegister }) {
|
||||
className="login-input"
|
||||
type="email"
|
||||
placeholder="username"
|
||||
onInput={e => details.name = e.target.value}
|
||||
onInput={e => setName(e.target.value)}
|
||||
/>
|
||||
<input
|
||||
className="login-input"
|
||||
type="password"
|
||||
placeholder="password"
|
||||
onInput={e => details.password = e.target.value}
|
||||
onInput={e => setPassword(e.target.value)}
|
||||
/>
|
||||
<button
|
||||
className="login-btn"
|
||||
onClick={() => submitLogin(details.name, details.password)}>
|
||||
onClick={() => submitLogin(name, password)}>
|
||||
Login
|
||||
</button>
|
||||
<button
|
||||
className="login-btn"
|
||||
onClick={() => submitRegister(details.name, details.password)}>
|
||||
onClick={() => submitRegister(name, password)}>
|
||||
Register
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user