fix: load default folder #417

This commit is contained in:
Daan Wijns 2022-06-05 10:24:09 +02:00
parent 68223f5f45
commit c63d0a4039
5 changed files with 15 additions and 8 deletions

View file

@ -282,8 +282,6 @@ export default {
}
},
created() {
this.$store.commit('FETCH_SETTINGS')
this.$store.commit('FETCH_CATEGORIES')
this.urls = this.initialMagnet
this.setSettings()
if (this.openSuddenly == true) {
@ -294,11 +292,15 @@ export default {
this.dTransition = 'scale-transition'
},
methods: {
setSettings() {
async setSettings() {
await this.$store.dispatch('FETCH_SETTINGS')
await this.$store.commit('FETCH_CATEGORIES')
const settings = this.getSettings()
console.log(settings)
this.start = !settings.start_paused_enabled
this.autoTMM = settings.auto_tmm_enabled
this.root_folder = settings.create_subfolder_enabled
this.directory = settings.save_path
},
addDropFile(e) {
this.showWrapDrag = false

View file

@ -114,7 +114,7 @@ export default {
}
},
created() {
this.$store.commit('FETCH_SETTINGS')
this.$store.dispatch('FETCH_SETTINGS')
},
methods: {
close() {

View file

@ -13,7 +13,7 @@ export default {
qbit.setPreferences(this.getSettings()).then(() => {
Vue.$toast.success(this.$t('toast.settingsSaved'))
})
await this.$store.commit('FETCH_SETTINGS')
await this.$store.dispatch('FETCH_SETTINGS')
await this.$store.commit('SET_LANGUAGE')
this.close()
if (!this.settings.alternative_webui_enabled) {

View file

@ -23,5 +23,11 @@ export default {
Vue.$toast.error(i18n.t('toast.loginFailed'))
return false
},
FETCH_SETTINGS: async context => {
const { data } = await qbit.getAppPreferences()
context.commit('FETCH_SETTINGS', data)
return data
}
}

View file

@ -65,9 +65,8 @@ export default {
Torrents.update(data)
DocumentTitle.update()
},
FETCH_SETTINGS: async state => {
const { data } = await qbit.getAppPreferences()
state.settings = data
FETCH_SETTINGS: async (state, settings) => {
state.settings = settings
},
UPDATE_SORT_OPTIONS: (state, {
hashes = [],