mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 20:35:02 -02:30
Build inputSourcesMap using an array reduce method instead of forEach with a local variable.
This commit is contained in:
@@ -37,11 +37,12 @@ function CredentialEdit({ credential, me }) {
|
|||||||
CredentialsAPI.readInputSources(credential.id, { page_size: 200 }),
|
CredentialsAPI.readInputSources(credential.id, { page_size: 200 }),
|
||||||
]);
|
]);
|
||||||
setCredentialTypes(loadedCredentialTypes);
|
setCredentialTypes(loadedCredentialTypes);
|
||||||
const inputSourcesMap = {};
|
setInputSources(
|
||||||
loadedInputSources.forEach(inputSource => {
|
loadedInputSources.reduce((inputSourcesMap, inputSource) => {
|
||||||
inputSourcesMap[inputSource.input_field_name] = inputSource;
|
inputSourcesMap[inputSource.input_field_name] = inputSource;
|
||||||
});
|
return inputSourcesMap;
|
||||||
setInputSources(inputSourcesMap);
|
}, {})
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err);
|
setError(err);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user