Starting to add feedback in the registration (fixes #78)

This commit is contained in:
cami 2021-06-28 03:46:27 +02:00
parent 10766dc601
commit a032ca946e
2 changed files with 28 additions and 11 deletions

View file

@ -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)
}
});
};