register account proper err handling

This commit is contained in:
Mashy
2019-07-20 01:04:02 +10:00
parent b289ed92de
commit c44cd44933
3 changed files with 32 additions and 11 deletions
+4 -5
View File
@@ -23,11 +23,10 @@ const addState = connect(
function submitRegister(name, password, code) {
postData('/register', { name, password, code })
.then(res => {
if (!res.ok) return errorToast(res);
res.text()
})
.then(res => {
.then(res => res.json())
.then(data => {
if (!data.success) return errorToast(data.error_message);
console.log(data.response);
ws.connect();
})
.catch(error => errorToast(error));