Skip to content

A full-featured download manager.

feat: batch remove task api

Dr_rOot28936fd13efd
diff --git a/src/renderer/api/Api.js b/src/renderer/api/Api.js
index e88351ab..0b99a105 100644
--- a/src/renderer/api/Api.js
+++ b/src/renderer/api/Api.js
@@ -338,4 +338,16 @@ export default class Api {
batchChangeOption (params = {}) {
return this.multicall('aria2.changeOption', params)
}
+
+ batchRemoveTask (params = {}) {
+ return this.multicall('aria2.remove', params)
+ }
+
+ batchPauseTask (params = {}) {
+ return this.multicall('aria2.pause', params)
+ }
+
+ batchForcePauseTask (params = {}) {
+ return this.multicall('aria2.forcePause', params)
+ }
}
diff --git a/src/renderer/store/modules/task.js b/src/renderer/store/modules/task.js
index 6447c547..90a36438 100644
--- a/src/renderer/store/modules/task.js
+++ b/src/renderer/store/modules/task.js
@@ -172,6 +172,16 @@ const actions = {
} else if (status === WAITING || status === PAUSED) {
return dispatch('resumeTask', task)
}
+ },
+ batchForcePauseTask (_, gids) {
+ return api.batchForcePauseTask({ gids })
+ },
+ batchRemoveTask ({ dispatch }, gids) {
+ return api.batchRemoveTask({ gids })
+ .finally(() => {
+ dispatch('fetchList')
+ dispatch('saveSession')
+ })
}
}