Skip to content

A full-featured download manager.

refactor: rename store actions mutations

Dr_rOot9d95d294cda3
diff --git a/src/renderer/pages/index/commands.js b/src/renderer/pages/index/commands.js
index c6a834cc..e5d3c881 100644
--- a/src/renderer/pages/index/commands.js
+++ b/src/renderer/pages/index/commands.js
@@ -22,7 +22,7 @@ const updateSystemTheme = (payload = {}) => {
const updateTheme = (payload = {}) => {
const { theme } = payload
- store.dispatch('preference/changeThemeConfig', theme)
+ store.dispatch('preference/updateThemeConfig', theme)
}
const showAboutPanel = () => {
diff --git a/src/renderer/store/modules/app.js b/src/renderer/store/modules/app.js
index 6431f1a9..4ec6fa3a 100644
--- a/src/renderer/store/modules/app.js
+++ b/src/renderer/store/modules/app.js
@@ -34,10 +34,10 @@ const getters = {
}
const mutations = {
- CHANGE_SYSTEM_THEME (state, theme) {
+ UPDATE_SYSTEM_THEME (state, theme) {
state.systemTheme = theme
},
- CHANGE_ABOUT_PANEL_VISIBLE (state, visible) {
+ UPDATE_ABOUT_PANEL_VISIBLE (state, visible) {
state.aboutPanelVisible = visible
},
UPDATE_ENGINE_INFO (state, engineInfo) {
@@ -49,16 +49,16 @@ const mutations = {
UPDATE_GLOBAL_STAT (state, stat) {
state.stat = stat
},
- CHANGE_ADD_TASK_VISIBLE (state, visible) {
+ UPDATE_ADD_TASK_VISIBLE (state, visible) {
state.addTaskVisible = visible
},
- CHANGE_ADD_TASK_TYPE (state, taskType) {
+ UPDATE_ADD_TASK_TYPE (state, taskType) {
state.addTaskType = taskType
},
- CHANGE_ADD_TASK_URL (state, text) {
+ UPDATE_ADD_TASK_URL (state, text) {
state.addTaskUrl = text
},
- CHANGE_ADD_TASK_TORRENTS (state, fileList) {
+ UPDATE_ADD_TASK_TORRENTS (state, fileList) {
state.addTaskTorrents = [...fileList]
},
UPDATE_ADD_TASK_OPTIONS (state, options) {
@@ -93,13 +93,13 @@ const mutations = {
const actions = {
updateSystemTheme ({ commit }, theme) {
- commit('CHANGE_SYSTEM_THEME', theme)
+ commit('UPDATE_SYSTEM_THEME', theme)
},
showAboutPanel ({ commit }) {
- commit('CHANGE_ABOUT_PANEL_VISIBLE', true)
+ commit('UPDATE_ABOUT_PANEL_VISIBLE', true)
},
hideAboutPanel ({ commit }) {
- commit('CHANGE_ABOUT_PANEL_VISIBLE', false)
+ commit('UPDATE_ABOUT_PANEL_VISIBLE', false)
},
fetchEngineInfo ({ commit }) {
api.getVersion()
@@ -140,22 +140,22 @@ const actions = {
commit('INCREASE_INTERVAL', millisecond)
},
showAddTaskDialog ({ commit }, taskType) {
- commit('CHANGE_ADD_TASK_TYPE', taskType)
- commit('CHANGE_ADD_TASK_VISIBLE', true)
+ commit('UPDATE_ADD_TASK_TYPE', taskType)
+ commit('UPDATE_ADD_TASK_VISIBLE', true)
},
hideAddTaskDialog ({ commit }) {
- commit('CHANGE_ADD_TASK_VISIBLE', false)
- commit('CHANGE_ADD_TASK_URL', '')
- commit('CHANGE_ADD_TASK_TORRENTS', [])
+ commit('UPDATE_ADD_TASK_VISIBLE', false)
+ commit('UPDATE_ADD_TASK_URL', '')
+ commit('UPDATE_ADD_TASK_TORRENTS', [])
},
changeAddTaskType ({ commit }, taskType) {
- commit('CHANGE_ADD_TASK_TYPE', taskType)
+ commit('UPDATE_ADD_TASK_TYPE', taskType)
},
updateAddTaskUrl ({ commit }, uri = '') {
- commit('CHANGE_ADD_TASK_URL', uri)
+ commit('UPDATE_ADD_TASK_URL', uri)
},
addTaskAddTorrents ({ commit }, { fileList }) {
- commit('CHANGE_ADD_TASK_TORRENTS', fileList)
+ commit('UPDATE_ADD_TASK_TORRENTS', fileList)
},
updateAddTaskOptions ({ commit }, options = {}) {
commit('UPDATE_ADD_TASK_OPTIONS', options)
diff --git a/src/renderer/store/modules/preference.js b/src/renderer/store/modules/preference.js
index c6a4e91a..21fa53b3 100644
--- a/src/renderer/store/modules/preference.js
+++ b/src/renderer/store/modules/preference.js
@@ -32,7 +32,7 @@ const actions = {
commit('UPDATE_PREFERENCE_DATA', config)
return api.savePreference(config)
},
- changeThemeConfig ({ commit }, theme) {
+ updateThemeConfig ({ commit }, theme) {
commit('UPDATE_PREFERENCE_DATA', { theme })
},
fetchBtTracker (_, trackerSource = []) {