Starting to add feedback in the registration (fixes #78)
This commit is contained in:
parent
10766dc601
commit
a032ca946e
2 changed files with 28 additions and 11 deletions
|
@ -9,16 +9,23 @@ export default function Login() {
|
|||
const [username, setUsername] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
|
||||
const [message, setMessage] = useState("");
|
||||
|
||||
const onSubmitClick = (e) => {
|
||||
e.preventDefault();
|
||||
let opts = {
|
||||
username: username,
|
||||
password: password,
|
||||
};
|
||||
console.log(opts);
|
||||
fetch("/api/register", {
|
||||
method: "post",
|
||||
body: JSON.stringify(opts),
|
||||
}).then((response) => {
|
||||
if (response.status === 409) {
|
||||
setMessage(response.message)
|
||||
console.log(message)
|
||||
console.log(response)
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue