register account proper err handling
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user