Skip to content

Commit

Permalink
fix: advanced preferences changed
Browse files Browse the repository at this point in the history
  • Loading branch information
agalwood committed Jul 4, 2019
1 parent 571499c commit a158708
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/renderer/components/Preference/Advanced.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,12 @@
data: function () {
const { locale } = this.$store.state.preference.config
const form = initialForm(this.$store.state.preference.config)
const formOriginal = cloneDeep(form)
return {
form,
formLabelWidth: calcFormLabelWidth(locale),
formOriginal: cloneDeep(form),
formOriginal,
hideRpcSecret: true,
rules: {},
trackerSyncing: false
Expand Down Expand Up @@ -327,6 +329,13 @@
}
})
},
syncFormConfig () {
this.$store.dispatch('preference/fetchPreference')
.then((config) => {
this.form = initialForm(config)
this.formOriginal = cloneDeep(this.form)
})
},
submitForm (formName) {
this.$refs[formName].validate((valid) => {
if (!valid) {
Expand All @@ -346,6 +355,7 @@
this.$store.dispatch('preference/save', data)
.then(() => {
this.$store.dispatch('app/fetchEngineOptions')
this.syncFormConfig()
this.$msg.success(this.$t('preferences.save-success-message'))
})
.catch(() => {
Expand All @@ -362,7 +372,7 @@
})
},
resetForm (formName) {
this.form = initialForm(this.$store.state.preference.config)
this.syncFormConfig()
}
}
}
Expand Down

0 comments on commit a158708

Please sign in to comment.