diff --git a/src/views/settings/components/inputComponents/SslOptionsInput.vue b/src/views/settings/components/inputComponents/SslOptionsInput.vue index b2df2ec7..ec80df2e 100644 --- a/src/views/settings/components/inputComponents/SslOptionsInput.vue +++ b/src/views/settings/components/inputComponents/SslOptionsInput.vue @@ -1,15 +1,18 @@ @@ -61,11 +64,21 @@ export default { inputValue(key) { return this.data[this.setting.key][key] }, - update(value, key) { - const updatedState = { ...this.data, [this.setting.key]: { ...this.data[this.setting.key], [key]: value }} + update(value, childKey) { + const [group, key, parentKey, input] = [this.settingGroup.group, this.settingGroup.key, this.setting.key, this.settingParent.key] + const { updatedSettings, description } = this.$store.state.settings + const type = description + .find(element => element.group === group && element.key === key).children + .find(child => child.key === ':adapter').children.find(child => child.key === ':ssl_options').children + .find(child => child.key === childKey).type - this.$store.dispatch('UpdateSettings', { group: this.settingGroup.group, key: this.settingGroup.key, input: this.settingParent.key, value: updatedState, type: this.settingParent.type }) - this.$store.dispatch('UpdateState', { group: this.settingGroup.group, key: this.settingGroup.key, input: this.settingParent.key, value: updatedState }) + const updatedState = { ...this.data, [parentKey]: { ...this.data[parentKey], [childKey]: value }} + const updatedSetting = !updatedSettings[group] || !updatedSettings[group][key] + ? { [parentKey]: ['keyword', { [childKey]: [type, value] }] } + : { ...updatedSettings[group][key][parentKey], [parentKey]: { ...updatedSettings[group][key][parentKey], [childKey]: [type, value] }} + + this.$store.dispatch('UpdateSettings', { group, key, input, value: updatedSetting, type: this.settingParent.type }) + this.$store.dispatch('UpdateState', { group, key, input, value: updatedState }) } } }