lbry-desktop/ui/component/settingWalletServer/index.js

30 lines
1.1 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { DAEMON_SETTINGS, selectIsWalletReconnecting } from 'lbry-redux';
import {
doSetDaemonSetting,
doClearDaemonSetting,
doGetDaemonStatus,
doSaveCustomWalletServers,
} from 'redux/actions/settings';
import { selectSavedWalletServers, selectDaemonStatus, selectHasWalletServerPrefs } from 'redux/selectors/settings';
import SettingWalletServer from './view';
const select = state => ({
2019-12-12 21:18:13 +01:00
daemonStatus: selectDaemonStatus(state),
customWalletServers: selectSavedWalletServers(state),
hasWalletServerPrefs: selectHasWalletServerPrefs(state),
walletReconnecting: selectIsWalletReconnecting(state),
});
const perform = dispatch => ({
setCustomWalletServers: value => dispatch(doSetDaemonSetting(DAEMON_SETTINGS.LBRYUM_SERVERS, value)),
clearWalletServers: () => dispatch(doClearDaemonSetting(DAEMON_SETTINGS.LBRYUM_SERVERS)),
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
saveServerConfig: servers => dispatch(doSaveCustomWalletServers(servers)),
});
export default connect(
select,
perform
)(SettingWalletServer);