targetdetail

This commit is contained in:
insanity 2017-07-21 14:17:49 +09:00
parent 5c28e542c7
commit dc3941def7
3 changed files with 7 additions and 3 deletions

View File

@ -5,6 +5,8 @@ import {
DispatchProps as DispatchProps, DispatchProps as DispatchProps,
} from './components/TargetDetail'; } from './components/TargetDetail';
import * as targetDetailActions from '../redux/action/read';
export function mapStateToProps(state: any): StateProps { export function mapStateToProps(state: any): StateProps {
return { return {
probe: state.probe, probe: state.probe,
@ -13,6 +15,9 @@ export function mapStateToProps(state: any): StateProps {
export function mapDispatchToProps(dispatch: Dispatch<any>): DispatchProps { export function mapDispatchToProps(dispatch: Dispatch<any>): DispatchProps {
return { return {
onRead: (id: string) => {
dispatch(targetDetailActions.request(id));
},
}; };
} }

View File

@ -13,7 +13,7 @@ export interface StateProps {
} }
export interface DispatchProps { export interface DispatchProps {
onRead(id: string): void;
} }
export type Props = StateProps & DispatchProps; export type Props = StateProps & DispatchProps;

View File

@ -23,7 +23,7 @@ export interface State {
export class TargetList extends React.Component<Props, State> { export class TargetList extends React.Component<Props, State> {
private data: any; private data: any;
constructor(props: Props, context: State) { constructor(props: Props, context: State) {
super(props, context); super(props, context);
this.state = { this.state = {
@ -34,7 +34,6 @@ export class TargetList extends React.Component<Props, State> {
} }
public handleAddTarget(event: React.MouseEvent<HTMLButtonElement>, data: ButtonProps): void { public handleAddTarget(event: React.MouseEvent<HTMLButtonElement>, data: ButtonProps): void {
alert('test');
this.setState({ this.setState({
openAddTarget: true, openAddTarget: true,
}); });