diff options
Diffstat (limited to 'web/src/js/ducks')
-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 }) +} |