Skip to content

Commit

Permalink
fix: load default folder VueTorrent#417
Browse files Browse the repository at this point in the history
  • Loading branch information
WDaan committed Jun 5, 2022
1 parent 68223f5 commit c63d0a4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/components/Modals/AddModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modals/SettingsModal/SettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default {
}
},
created() {
this.$store.commit('FETCH_SETTINGS')
this.$store.dispatch('FETCH_SETTINGS')
},
methods: {
close() {
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/SettingsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
5 changes: 2 additions & 3 deletions src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [],
Expand Down

0 comments on commit c63d0a4

Please sign in to comment.