diff --git a/renderer/src/core/projects/updateAgSettings.js b/renderer/src/core/projects/updateAgSettings.js index eebe709a4..0c27d716f 100644 --- a/renderer/src/core/projects/updateAgSettings.js +++ b/renderer/src/core/projects/updateAgSettings.js @@ -13,7 +13,6 @@ import { // } export const updateAgSettings = async (username, projectName, data, font) => { - console.log(JSON.stringify(data.project[data.type.flavorType.flavor.name])); logger.debug('updateAgSettings.js', 'In updateAgSettings'); const newpath = localStorage.getItem('userPath'); const fs = window.require('fs'); @@ -22,8 +21,7 @@ export const updateAgSettings = async (username, projectName, data, font) => { const folder = path.join(newpath, packageInfo.name, 'users', username, 'projects', projectName, result[0]); const settings = await fs.readFileSync(folder, 'utf8'); const setting = JSON.parse(settings); - setting.project[data.type.flavorType.flavor.name] = data.project[data.type.flavorType.flavor.name]; - if (settings.version !== environment.AG_SETTING_VERSION) { + if (setting.version !== environment.AG_SETTING_VERSION) { setting.version = environment.AG_SETTING_VERSION; if (!setting.sync && !setting.sync?.services) { setting.sync = { services: { door43: [] } }; @@ -32,11 +30,11 @@ export const updateAgSettings = async (username, projectName, data, font) => { } if (!setting.project[data.type.flavorType.flavor.name].font) { setting.project[data.type.flavorType.flavor.name].font = font || ''; - } else { - setting.project[data.type.flavorType.flavor.name].font = font || setting.project[data.type.flavorType.flavor.name].font; } } - console.log(JSON.stringify(setting)); + const savedFont = JSON.stringify(setting.project[data.type.flavorType.flavor.name].font); + setting.project[data.type.flavorType.flavor.name] = data.project[data.type.flavorType.flavor.name]; + setting.project[data.type.flavorType.flavor.name].font = font || JSON.parse(savedFont); logger.debug('updateAgSettings.js', `Updating the ${environment.PROJECT_SETTING_FILE}`); await fs.writeFileSync(folder, JSON.stringify(setting)); };