2017-06-06 23:19:12 +02:00
|
|
|
import * as types from "constants/action_types";
|
|
|
|
import lbry from "lbry";
|
2017-05-17 23:52:45 +02:00
|
|
|
|
|
|
|
export function doFetchDaemonSettings() {
|
|
|
|
return function(dispatch, getState) {
|
2017-06-06 23:19:12 +02:00
|
|
|
lbry.settings_get().then(settings => {
|
2017-05-17 23:52:45 +02:00
|
|
|
dispatch({
|
|
|
|
type: types.DAEMON_SETTINGS_RECEIVED,
|
|
|
|
data: {
|
2017-06-06 23:19:12 +02:00
|
|
|
settings,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
2017-05-17 23:52:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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 => {
|
2017-05-17 23:52:45 +02:00
|
|
|
dispatch({
|
|
|
|
type: types.DAEMON_SETTINGS_RECEIVED,
|
|
|
|
data: {
|
2017-06-06 23:19:12 +02:00
|
|
|
settings,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
2017-06-06 06:21:55 +02:00
|
|
|
}
|