implements max holder and validation on UI

This commit is contained in:
2021-06-11 17:58:09 +02:00
parent af740fd87d
commit 807d3674fc
8 changed files with 50 additions and 38 deletions

View File

@@ -16,32 +16,13 @@ const householdMove = (payload) => {
if (response.ok) {
return response.json();
}
throw Error('Error with testing move');
});
};
const householdMoveTest = (payload) => {
const url = `/api/1.0/person/household/members/move/test.json`;
return fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
})
.then(response => {
if (response.status === 422) {
return response.json();
}
if (response.ok) {
// return an empty array if ok
return new Promise((resolve, reject) => resolve({ violations: [] }) );
}
throw Error('Error with testing move');
});
};
export {
householdMove,
householdMoveTest
};