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

32 lines
633 B
JavaScript
Raw Normal View History

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