changed props

This commit is contained in:
snoop 2017-07-20 16:53:07 +09:00
parent 1f3ad4b588
commit 437f124d2c
2 changed files with 10 additions and 12 deletions

View File

@ -1,8 +1,8 @@
import { connect, Dispatch } from 'react-redux'; import { connect, Dispatch } from 'react-redux';
import { import {
SensorList, SensorList,
Props as SensorListProps, StateProps as SensorListStateProps,
State as SensorListState, DispatchProps as SensorListDispatchProps,
} from './components/SensorList'; } from './components/SensorList';
import State from '../redux/state/ReadAllByTarget'; import State from '../redux/state/ReadAllByTarget';
@ -10,19 +10,12 @@ import * as ReadAllByTargetActions from '../redux/action/read_all_by_target';
import Target from '@overflow/target/api/model/Target'; import Target from '@overflow/target/api/model/Target';
import Sensor from '@overflow/sensor/api/model/Sensor'; import Sensor from '@overflow/sensor/api/model/Sensor';
export function mapStateToProps(state: any): SensorListProps { export function mapStateToProps(state: any): SensorListStateProps {
return { return {
}; };
} }
// const mapDispatchToProps = (dispatch: Dispatch<any>) => ({ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchProps {
// onReadAllByTarget: (target: Target) => {
// dispatch(ReadAllByTargetActions.request(target));
// },
// });
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListProps {
return { return {
onReadAllByTarget: (target: Target) => { onReadAllByTarget: (target: Target) => {
dispatch(ReadAllByTargetActions.request(target)); dispatch(ReadAllByTargetActions.request(target));

View File

@ -6,11 +6,16 @@ import Probe from '@overflow/probe/api/model/Probe';
import Sensor from '@overflow/sensor/api/model/Sensor'; import Sensor from '@overflow/sensor/api/model/Sensor';
import Target from '@overflow/target/api/model/Target'; import Target from '@overflow/target/api/model/Target';
export interface Props { export interface StateProps {
target?: Target; target?: Target;
}
export interface DispatchProps {
onReadAllByTarget?(target: Target): void; onReadAllByTarget?(target: Target): void;
} }
export type Props = StateProps & DispatchProps;
export interface State { export interface State {
isDetail: boolean; isDetail: boolean;
selected: Sensor; selected: Sensor;