mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
fix errors with null values for array types
This commit is contained in:
@@ -117,12 +117,26 @@ export function modifyConfigReset() {
|
||||
|
||||
//reducer
|
||||
|
||||
function removeNullValues(config: Config) {
|
||||
if (!config.adminGroups) {
|
||||
config.adminGroups = [];
|
||||
}
|
||||
if (!config.adminUsers) {
|
||||
config.adminUsers = [];
|
||||
}
|
||||
if (!config.proxyExcludes) {
|
||||
config.proxyExcludes = [];
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
function reducer(state: any = {}, action: any = {}) {
|
||||
switch (action.type) {
|
||||
case FETCH_CONFIG_SUCCESS:
|
||||
const config = removeNullValues(action.payload);
|
||||
return {
|
||||
...state,
|
||||
entries: action.payload,
|
||||
entries: config,
|
||||
configUpdatePermission: action.payload._links.update ? true : false
|
||||
};
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user