From 8c3e988a8c95bae7235d5de4ba8e85e77988c395 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Mon, 24 Jul 2017 20:34:15 +0800 Subject: [web] Add Download/Load button to OptionEditor. --- web/src/js/ducks/options.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'web/src/js/ducks') 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 }) +} -- cgit v1.2.3 From c7e41b32abba017210ef5c2dc3961554a9b6b9b3 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Wed, 26 Jul 2017 15:09:11 +0800 Subject: [web] Update options auto dump for frontend. --- web/src/js/ducks/options.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'web/src/js/ducks') diff --git a/web/src/js/ducks/options.js b/web/src/js/ducks/options.js index b22030a3..d319b171 100644 --- a/web/src/js/ducks/options.js +++ b/web/src/js/ducks/options.js @@ -5,7 +5,6 @@ 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 = {} @@ -46,13 +45,6 @@ export function update(option, value) { } } -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 }) +export function dump() { + return dispatch => fetchApi('/options/dump', { method: 'POST' }) } -- cgit v1.2.3 From 7e5f424c5013a591e71f570b003e34f8e6788869 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Thu, 27 Jul 2017 11:22:02 +0800 Subject: [web] Minor fix for frontend and tests. --- web/src/js/ducks/options.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/src/js/ducks') diff --git a/web/src/js/ducks/options.js b/web/src/js/ducks/options.js index d319b171..0da0fb8c 100644 --- a/web/src/js/ducks/options.js +++ b/web/src/js/ducks/options.js @@ -45,6 +45,6 @@ export function update(option, value) { } } -export function dump() { - return dispatch => fetchApi('/options/dump', { method: 'POST' }) +export function save() { + return dispatch => fetchApi('/options/save', { method: 'POST' }) } -- cgit v1.2.3