Minor bugfixes

This commit is contained in:
2021-01-27 01:52:18 +11:00
parent 8c754b4570
commit 6468b02647
4 changed files with 15 additions and 8 deletions
+8 -5
View File
@@ -23,9 +23,12 @@ const LogIn = props => {
evt => {
evt.preventDefault();
handleSubmit(emailElement.value, passwordElement.value)
.then(res => res ? alert(res) : null)
.then(() => emailElement.value = passwordElement.value = '') //clear input
.then(() => { window.location.reload(true); }) //BUFGIX: force reload of the header element
.then(([res, ok]) => {
alert(res);
if (ok) {
window.location.reload(true); //BUFGIX: force reload of the header element
}
})
.catch(e => console.error(e))
;
}
@@ -64,9 +67,9 @@ const handleSubmit = async (email, password) => {
const result = await fetch('/api/accounts/login', { method: 'POST', body: formData });
if (result.ok) {
return result.text();
return [await result.text(), true];
} else {
return result.text();
return [await result.text(), false];
}
};
+1 -1
View File
@@ -22,7 +22,7 @@ const Member = () => {
};
const logout = async () => {
await fetch('/api/accounts/logout')
await fetch('/api/accounts/logout', { method: 'POST' })
.catch(e => console.error(e))
;
};