From c5561a915e129adc6d1dffe96731887d3aed29a2 Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 20 Jul 2017 19:04:35 +0900 Subject: [PATCH] fixed sensor --- src/ts/@overflow/sensor/react/SensorDetail.tsx | 9 +++++---- .../sensor/react/components/SensorDetail.tsx | 4 ++-- .../sensor/react/components/SensorList.tsx | 5 +++-- src/ts/@overflow/sensor/redux/state/Read.ts | 16 +++++++++++++--- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/ts/@overflow/sensor/react/SensorDetail.tsx b/src/ts/@overflow/sensor/react/SensorDetail.tsx index f2d3754..7c2a594 100644 --- a/src/ts/@overflow/sensor/react/SensorDetail.tsx +++ b/src/ts/@overflow/sensor/react/SensorDetail.tsx @@ -4,21 +4,22 @@ import { SensorDetailStateProps, SensorDetailDispatchProps, } from './components/SensorDetail'; -import State from '../redux/state/ReadAllByTarget'; +import State from '../redux/state/Read'; -import * as ReadAllByTargetActions from '../redux/action/read_all_by_target'; +import * as ReadActions from '../redux/action/read'; import Target from '@overflow/target/api/model/Target'; import Sensor from '@overflow/sensor/api/model/Sensor'; export function mapStateToProps(state: any): SensorDetailStateProps { return { + sensor:state.sensor, }; } export function mapDispatchToProps(dispatch: Dispatch): SensorDetailDispatchProps { return { - onReadAllByTarget: (target: Target) => { - dispatch(ReadAllByTargetActions.request(target)); + onRead: (id: number) => { + dispatch(ReadActions.request(id)); }, }; } diff --git a/src/ts/@overflow/sensor/react/components/SensorDetail.tsx b/src/ts/@overflow/sensor/react/components/SensorDetail.tsx index 9e76b40..89b841d 100644 --- a/src/ts/@overflow/sensor/react/components/SensorDetail.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorDetail.tsx @@ -11,7 +11,7 @@ export interface SensorDetailStateProps { } export interface SensorDetailDispatchProps { - + onRead?(id: number): void; } @@ -31,7 +31,7 @@ export class SensorDetail extends React.Component); + // return (); + return (); } return ( diff --git a/src/ts/@overflow/sensor/redux/state/Read.ts b/src/ts/@overflow/sensor/redux/state/Read.ts index 5c15c15..45212ae 100644 --- a/src/ts/@overflow/sensor/redux/state/Read.ts +++ b/src/ts/@overflow/sensor/redux/state/Read.ts @@ -1,3 +1,13 @@ -/** - * Created by geek on 17. 7. 3. - */ +import Sensor from '../../api/model/Sensor'; + +export interface State { + readonly isGetSensor: boolean; + readonly error?: Error; +} + +export const defaultState: State = { + isGetSensor: undefined, + error: undefined, +}; + +export default State;