diff options
author | Matthew Shao <me@matshao.com> | 2017-07-24 20:34:15 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-07-24 20:34:15 +0800 |
commit | 8c3e988a8c95bae7235d5de4ba8e85e77988c395 (patch) | |
tree | 173017081389b5d56ea471aed8c2e92d694abf6b /web/src/js/ducks/options.js | |
parent | 38d926d159221d7e4a4bd2c895a040f351f5264f (diff) | |
download | mitmproxy-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.js | 12 |
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 }) +} |