mirror of
https://github.com/xfarrow/blink
synced 2025-02-11 07:30:35 +01:00
better API error handling
This commit is contained in:
parent
b2abaf7685
commit
35f04d70df
@ -61,7 +61,7 @@
|
||||
document.cookie = `token=${data.token};`;
|
||||
window.location.href = 'userprofile.html?id=me';
|
||||
} else {
|
||||
alert(data.error);
|
||||
callbackErrors(data.errors, alert);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -5,7 +5,6 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Sign Up to Blink</title>
|
||||
<link rel="stylesheet" href="../css/login-register.css">
|
||||
<script src=""></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -77,7 +76,7 @@
|
||||
}
|
||||
window.location.href = '/login.html';
|
||||
} else {
|
||||
alert(data.error);
|
||||
callbackErrors(data.errors, alert);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
@ -8,4 +8,8 @@ function getCookie(name) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function callbackErrors(errors, func) {
|
||||
errors.forEach(error => func(error.msg));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user