From 4af1a7ace147be12edc04578c4fe281f6481c576 Mon Sep 17 00:00:00 2001 From: snoop Date: Wed, 26 Jul 2017 15:22:37 +0900 Subject: [PATCH] fixed router --- src/ts/@overflow/sensor/react/SensorList.tsx | 6 ++++++ .../@overflow/sensor/react/components/SensorList.tsx | 10 +++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ts/@overflow/sensor/react/SensorList.tsx b/src/ts/@overflow/sensor/react/SensorList.tsx index 61926b0..7f22fe5 100644 --- a/src/ts/@overflow/sensor/react/SensorList.tsx +++ b/src/ts/@overflow/sensor/react/SensorList.tsx @@ -1,4 +1,6 @@ import { connect, Dispatch } from 'react-redux'; +import { push as routerPush } from 'react-router-redux'; + import { SensorList, StateProps as SensorListStateProps, @@ -6,6 +8,7 @@ import { } from './components/SensorList'; import State from '../redux/state/ReadAllByTarget'; + import * as ReadAllByTargetActions from '../redux/action/read_all_by_target'; import * as ReadAllByProbeActions from '../redux/action/read_all_by_probe'; import * as ReadAllByDomainActions from '../redux/action/read_all_by_domain'; @@ -30,6 +33,9 @@ export function mapDispatchToProps(dispatch: Dispatch): SensorListDispatchP onReadAllByDomain: (domain: Domain) => { dispatch(ReadAllByDomainActions.request(domain)); }, + onSensorSelect: (id: number) => { + dispatch(routerPush('/sensor/' + String(id))); + }, }; } diff --git a/src/ts/@overflow/sensor/react/components/SensorList.tsx b/src/ts/@overflow/sensor/react/components/SensorList.tsx index 048248e..d3de27b 100644 --- a/src/ts/@overflow/sensor/react/components/SensorList.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorList.tsx @@ -16,12 +16,12 @@ export interface DispatchProps { onReadAllByTarget?(target: Target): void; onReadAllByProbe?(probe: Probe): void; onReadAllByDomain?(domain: Domain): void; + onSensorSelect?(id: number): void; } export type SensorListProps = StateProps & DispatchProps; export interface SensorListState { - isDetail: boolean; selected: Sensor; } @@ -34,7 +34,6 @@ export class SensorList extends React.Component); - return (); - } return (
Sensors