mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-26 23:24:38 +02:00
⚡ Remove empty KeyCloak block from edit appConfig
This commit is contained in:
parent
3ea8fc960e
commit
d07a5f7e6f
@ -86,8 +86,15 @@ export default {
|
|||||||
/* Remove any attribute which has an undefined value before saving */
|
/* Remove any attribute which has an undefined value before saving */
|
||||||
removeUndefinedValues(rawAppConfig) {
|
removeUndefinedValues(rawAppConfig) {
|
||||||
const raw = rawAppConfig;
|
const raw = rawAppConfig;
|
||||||
const isEmpty = (value) => (value === undefined);
|
const isEmptyObject = (obj) => (typeof obj === 'object' && Object.keys(obj).length === 0);
|
||||||
Object.keys(raw).forEach(key => isEmpty(raw[key]) && delete raw[key]);
|
const isEmpty = (value) => (value === undefined || isEmptyObject(value));
|
||||||
|
// Delete empty values
|
||||||
|
Object.keys(raw).forEach(key => {
|
||||||
|
if (isEmpty(raw[key])) delete raw[key];
|
||||||
|
});
|
||||||
|
// If KC config empty, delete it
|
||||||
|
const kcConfig = raw.auth.keycloak;
|
||||||
|
if (!kcConfig.clientId && !kcConfig.realm && !kcConfig.serverUrl) delete raw.auth.keycloak;
|
||||||
return raw;
|
return raw;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user