Combine API props, update tests for redux hooks

This commit is contained in:
Nathan Barber
2021-04-08 18:28:49 -04:00
parent 21f4988f24
commit 51deaa36f3
18 changed files with 347 additions and 222 deletions

View File

@@ -107,17 +107,4 @@ AddUser.propTypes = {
}),
};
const withUserAPI = withProps((props) => ({
addUsers: (usernames, admin) =>
jhapiRequest("/users", "POST", { usernames, admin }),
failRegexEvent: () =>
alert(
"Removed " +
JSON.stringify(removed_users) +
" for either containing special characters or being too short."
),
refreshUserData: () =>
jhapiRequest("/users", "GET").then((data) => data.json()),
}));
export default compose(withUserAPI)(AddUser);
export default AddUser;