aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks/options.js
diff options
context:
space:
mode:
authorMatthew Shao <me@matshao.com>2017-07-24 20:34:15 +0800
committerMatthew Shao <me@matshao.com>2017-07-24 20:34:15 +0800
commit8c3e988a8c95bae7235d5de4ba8e85e77988c395 (patch)
tree173017081389b5d56ea471aed8c2e92d694abf6b /web/src/js/ducks/options.js
parent38d926d159221d7e4a4bd2c895a040f351f5264f (diff)
downloadmitmproxy-8c3e988a8c95bae7235d5de4ba8e85e77988c395.tar.gz
mitmproxy-8c3e988a8c95bae7235d5de4ba8e85e77988c395.tar.bz2
mitmproxy-8c3e988a8c95bae7235d5de4ba8e85e77988c395.zip
[web] Add Download/Load button to OptionEditor.
Diffstat (limited to 'web/src/js/ducks/options.js')
-rw-r--r--web/src/js/ducks/options.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/web/src/js/ducks/options.js b/web/src/js/ducks/options.js
index 06144a3c..b22030a3 100644
--- a/web/src/js/ducks/options.js
+++ b/web/src/js/ducks/options.js
@@ -5,6 +5,7 @@ import _ from "lodash"
export const RECEIVE = 'OPTIONS_RECEIVE'
export const UPDATE = 'OPTIONS_UPDATE'
export const REQUEST_UPDATE = 'REQUEST_UPDATE'
+export const SAVE = 'OPTION_SAVE'
const defaultState = {}
@@ -44,3 +45,14 @@ export function update(option, value) {
sendUpdate(option, value, dispatch);
}
}
+
+export function download() {
+ window.location = '/options/dump'
+ return { type: SAVE }
+}
+
+export function upload(file) {
+ const body = new FormData()
+ body.append('file', file)
+ return dispatch => fetchApi('/options/dump', { method: 'POST', body })
+}