Begin move to redux

This commit is contained in:
Scott E. Graves
2019-06-04 22:08:21 -05:00
parent a5e21c8dfc
commit fc48c9c0db
7 changed files with 64 additions and 14 deletions

View File

@@ -1,10 +1,12 @@
import React from 'react';
import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button';
import {connect} from 'react-redux';
import './MountItems.css';
import Modal from '../../components/UI/Modal/Modal';
import MountItem from '../../components/MountItem/MountItem';
import IPCContainer from '../IPCContainer/IPCContainer';
import {setBusy} from '../../redux/actions/mount_actions';
const Constants = require('../../constants');
@@ -67,7 +69,7 @@ class MountItems extends IPCContainer {
detectMounts = ()=> {
if (!this.state.DisplayRetry) {
this.props.mountsBusy(true);
this.props.setMountsBusy(true);
this.sendRequest(Constants.IPC_Detect_Mounts, {
Directory: this.props.directory,
Version: this.props.version,
@@ -131,7 +133,7 @@ class MountItems extends IPCContainer {
AllowMount: false,
};
this.props.mountsBusy(true);
this.props.setMountsBusy(true);
this.setState({
[storageType]: storageState,
@@ -170,7 +172,7 @@ class MountItems extends IPCContainer {
};
mountsBusy = mountsBusy || state[provider].Mounted;
}
this.props.mountsBusy(mountsBusy);
this.props.setMountsBusy(mountsBusy);
this.setState(state, () => {
const updateMountLocation = (data, provider) => {
@@ -333,4 +335,10 @@ class MountItems extends IPCContainer {
}
}
export default MountItems;
const mapDispatchToProps = dispatch => {
return {
setMountsBusy: busy => dispatch(setBusy(busy))
}
};
export default connect(null, mapDispatchToProps)(MountItems);