Skip to content
Snippets Groups Projects
Commit 9f858de2 authored by Neda Moeini's avatar Neda Moeini
Browse files

Enhance showing errors.

parent 52c40ad3
Branches
Tags
1 merge request!6Enhancement/improve error messages
...@@ -85,10 +85,10 @@ ...@@ -85,10 +85,10 @@
li.textContent = 'You are not authorized to perform this action.'; li.textContent = 'You are not authorized to perform this action.';
errorList.appendChild(li); errorList.appendChild(li);
} else if (response.status === 400 && result.status === 'error') { } else if (response.status === 400 && result.status === 'error') {
for (const [field, messages] of Object.entries(result.errors)) { for (const messages of Object.values(result.errors)) {
messages.forEach(message => { messages.forEach(message => {
const li = document.createElement('li'); const li = document.createElement('li');
li.textContent = `${field}: ${message}`; li.textContent = message;
errorList.appendChild(li); errorList.appendChild(li);
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment