Commit ff691472 authored by kushalpandya's avatar kushalpandya

Use array reduce instead of forEach

parent 73c4cfb7
......@@ -40,13 +40,14 @@ export default class ProtectedTagEdit {
}
updatePermissions() {
const formData = {};
Object.keys(ACCESS_LEVELS).forEach((level) => {
const formData = Object.keys(ACCESS_LEVELS).reduce((acc, level) => {
/* eslint-disable no-param-reassign */
const accessLevelName = ACCESS_LEVELS[level];
const inputData = this[`${accessLevelName}_dropdown`].getInputData(accessLevelName);
acc[`${accessLevelName}_attributes`] = inputData;
formData[`${accessLevelName}_attributes`] = this[`${accessLevelName}_dropdown`].getInputData(accessLevelName);
});
return acc;
}, {});
return $.ajax({
type: 'POST',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment