lbry-desktop/ui/js/actions/settings.js

32 lines
701 B
JavaScript
Raw Normal View History

2017-06-06 23:19:12 +02:00
import * as types from "constants/action_types";
import lbry from "lbry";
export function doFetchDaemonSettings() {
return function(dispatch, getState) {
2017-06-06 23:19:12 +02:00
lbry.settings_get().then(settings => {
dispatch({
type: types.DAEMON_SETTINGS_RECEIVED,
data: {
2017-06-06 23:19:12 +02:00
settings,
},
});
});
};
}
export function doSetDaemonSetting(key, value) {
return function(dispatch, getState) {
let settings = {};
settings[key] = value;
2017-06-06 23:19:12 +02:00
lbry.settings_set(settings).then(settings);
lbry.settings_get().then(settings => {
dispatch({
type: types.DAEMON_SETTINGS_RECEIVED,
data: {
2017-06-06 23:19:12 +02:00
settings,
},
});
});
};
2017-06-06 06:21:55 +02:00
}