2017-06-06 06:21:55 +02:00
|
|
|
import * as types from 'constants/action_types';
|
|
|
|
import lbry from 'lbry';
|
2017-05-17 23:52:45 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
2017-05-17 23:52:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|