Overwrite credential data only if there is no data set yet

This commit is contained in:
Jan Oberhauser 2020-09-06 22:16:42 +02:00
parent 6aaae1ef6c
commit 313c8c14dc

View file

@ -38,7 +38,12 @@ class CredentialsOverwritesClass {
}
const returnData = JSON.parse(JSON.stringify(data));
Object.assign(returnData, overwrites);
// Overwrite only if there is currently no data set
for (const key of Object.keys(overwrites)) {
if ([null, undefined, ''].includes(returnData[key])) {
returnData[key] = overwrites[key];
}
}
return returnData;
}