Skip to content

A full-featured download manager.

feat: fetch engineOptions (getGlobalOption)

Dr_rOot4d024eb6a653
diff --git a/src/renderer/api/Api.js b/src/renderer/api/Api.js
index 8d3f189d..291c6c6b 100644
--- a/src/renderer/api/Api.js
+++ b/src/renderer/api/Api.js
@@ -111,6 +111,15 @@ export default class Api {
return this.client.call('getVersion')
}
+ getGlobalOption () {
+ return new Promise((resolve) => {
+ this.client.call('getGlobalOption')
+ .then((data) => {
+ resolve(changeKeysToCamelCase(data))
+ })
+ })
+ }
+
getGlobalStat () {
return this.client.call('getGlobalStat')
}
diff --git a/src/renderer/components/Native/EngineClient.vue b/src/renderer/components/Native/EngineClient.vue
index 46e39768..c590bff0 100644
--- a/src/renderer/components/Native/EngineClient.vue
+++ b/src/renderer/components/Native/EngineClient.vue
@@ -172,6 +172,7 @@
},
created: function () {
this.$store.dispatch('app/fetchEngineInfo')
+ this.$store.dispatch('app/fetchEngineOptions')
this.startPolling()
diff --git a/src/renderer/store/modules/app.js b/src/renderer/store/modules/app.js
index 553b8219..128f9684 100644
--- a/src/renderer/store/modules/app.js
+++ b/src/renderer/store/modules/app.js
@@ -12,6 +12,7 @@ const state = {
version: '',
enabledFeatures: []
},
+ engineOptions: {},
interval: BASE_INTERVAL,
stat: {
downloadSpeed: 0,
@@ -35,6 +36,9 @@ const mutations = {
UPDATE_ENGINE_INFO (state, engineInfo) {
state.engineInfo = { ...state.engineInfo, ...engineInfo }
},
+ UPDATE_ENGINE_OPTIONS (state, engineOptions) {
+ state.engineOptions = { ...state.engineOptions, ...engineOptions }
+ },
UPDATE_GLOBAL_STAT (state, stat) {
state.stat = stat
},
@@ -85,6 +89,15 @@ const actions = {
commit('UPDATE_ENGINE_INFO', data)
})
},
+ fetchEngineOptions ({ commit }) {
+ return new Promise((resolve) => {
+ api.getGlobalOption()
+ .then((data) => {
+ commit('UPDATE_ENGINE_OPTIONS', data)
+ resolve(data)
+ })
+ })
+ },
fetchGlobalStat ({ commit, dispatch }) {
api.getGlobalStat()
.then((data) => {