diff --git a/web/source/settings-panel/admin/settings.js b/web/source/settings-panel/admin/settings.js index eb99c1747..198d7a073 100644 --- a/web/source/settings-panel/admin/settings.js +++ b/web/source/settings-panel/admin/settings.js @@ -25,15 +25,19 @@ const Redux = require("react-redux"); const Submit = require("../components/submit"); const api = require("../lib/api"); -const formFields = require("../lib/form-fields"); const adminActions = require("../redux/reducers/instances").actions; +const { + TextInput, + TextArea, + Checkbox, + File +} = require("../components/form-fields").formFields(adminActions.setAdminSettingsVal, (state) => state.instances.adminSettings); + module.exports = function AdminSettings() { const dispatch = Redux.useDispatch(); const instance = Redux.useSelector(state => state.instances.adminSettings); - const { onTextChange, onCheckChange, onFileChange } = formFields(dispatch, adminActions.setAdminSettingsVal, instance); - const [errorMsg, setError] = React.useState(""); const [statusMsg, setStatus] = React.useState(""); @@ -41,7 +45,7 @@ module.exports = function AdminSettings() { setStatus("PATCHing"); setError(""); return Promise.try(() => { - return dispatch(api.user.updateProfile()); + return dispatch(api.admin.updateProfile()); }).then(() => { setStatus("Saved!"); }).catch((e) => { @@ -50,18 +54,64 @@ module.exports = function AdminSettings() { }); } - // function removeFile(name) { - // return function(e) { - // e.preventDefault(); - // dispatch(user.setProfileVal([name, ""])); - // dispatch(user.setProfileVal([`${name}File`, ""])); - // }; - // } - return ( -