export const handle = (errors = {}) => {
for (let inputName in errors) {
const error = document.getElementById(inputName + '-error');
const label = document.querySelector(`[for="${inputName}"]`);
if (error) {
error.innerHTML = errors[inputName];
}
if (label) {
if (errors[inputName].length > 1) {
label.classList.add('error');
} else {
label.classList.remove('error');
}
}
}
}