Merge branch 'master' of https://git.loafle.net/overflow/overflow_app
This commit is contained in:
commit
4d96fb8d44
|
@ -12,8 +12,7 @@ export class SensorItemService extends Service {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo List<SensorItem>
|
public readAllBySensor(sensor:Sensor): Promise<SensorItem[]> {
|
||||||
public readAllBySensor(sensor:Sensor): Promise<SensorItem> {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,7 @@ export class SensorService extends Service {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo List<Sensor>
|
public readAllByTarget(target:Target): Promise<Sensor[]> {
|
||||||
public readAllByTarget(target:Target): Promise<Sensor> {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,42 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
*/
|
import ItemReadPayload from '../payload/ItemReadPayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor_item/read/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor_item/read/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor_item/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor_item/read/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor_item/read/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor_item/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (id: string) => Action<ItemReadPayload>;
|
||||||
|
export type requestSuccess = (sensorItem: SensorItem) => Action<SensorItem>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (id: string): Action<ItemReadPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensorItem: SensorItem): Action<SensorItem> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensorItem,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import ItemReadAllBySensorPayload from '../payload/ItemReadAllBySensorPayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (sensor: Sensor) => Action<ItemReadAllBySensorPayload>;
|
||||||
|
export type requestSuccess = (sensorItems: SensorItem[]) => Action<SensorItem[]>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (sensor: Sensor): Action<ItemReadAllBySensorPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
sensor: sensor,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensorItems: SensorItem[]): Action<SensorItem[]> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensorItems,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
|
@ -1,3 +1,42 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
*/
|
import ItemRegistPayload from '../payload/ItemRegistPayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor_item/regist/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor_item/regist/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor_item/regist/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor_item/regist/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor_item/regist/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor_item/regist/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (sensorItem: SensorItem) => Action<ItemRegistPayload>;
|
||||||
|
export type requestSuccess = (sensorItem: SensorItem) => Action<SensorItem>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (sensorItem: SensorItem): Action<ItemRegistPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
sensorItem: sensorItem,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensorItem: SensorItem): Action<SensorItem> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensorItem,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -1,3 +1,41 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
*/
|
import ItemRemovePayload from '../payload/ItemRemovePayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor_item/remove/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor_item/remove/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor_item/remove/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor_item/remove/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor_item/remove/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor_item/remove/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (sensorItem: SensorItem) => Action<ItemRemovePayload>;
|
||||||
|
export type requestSuccess = () => Action<void>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (sensorItem: SensorItem): Action<ItemRemovePayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
sensorItem: sensorItem,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (): Action<void> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -1,3 +1,42 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import Sensor from '../../api/model/Sensor';
|
||||||
*/
|
import ReadPayload from '../payload/ReadPayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/read/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/read/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/read/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/read/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (id: string) => Action<ReadPayload>;
|
||||||
|
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (id: string): Action<ReadPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensor,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
43
src/ts/@overflow/sensor/redux/action/read_all_by_target.ts
Normal file
43
src/ts/@overflow/sensor/redux/action/read_all_by_target.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import ReadAllByTargetPayload from '../payload/ReadAllByTargetPayload';
|
||||||
|
import Target from '@overflow/target/api/model/Target';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/read_all_by_target/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/read_all_by_target/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/read_all_by_target/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/read_all_by_target/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/read_all_by_target/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read_all_by_target/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (target: Target) => Action<ReadAllByTargetPayload>;
|
||||||
|
export type requestSuccess = (sensors: Sensor[]) => Action<Sensor[]>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (target: Target): Action<ReadAllByTargetPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
target: target,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensors: Sensor[]): Action<Sensor[]> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensors,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import RegistPayload from '../payload/RegistPayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/regist/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/regist/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/regist/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/regist/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/regist/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/regist/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (sensor: Sensor) => Action<RegistPayload>;
|
||||||
|
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (sensor: Sensor): Action<RegistPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
sensor: sensor,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensor,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,3 +1,42 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import Sensor from '../../api/model/Sensor';
|
||||||
*/
|
import RemovePayload from '../payload/RemovePayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/remove/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/remove/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/remove/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/remove/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/remove/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/remove/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (sensor: Sensor) => Action<RemovePayload>;
|
||||||
|
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (sensor: Sensor): Action<RemovePayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
sensor: sensor,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensor,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -1,3 +1,42 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import Sensor from '../../api/model/Sensor';
|
||||||
*/
|
import StartPayload from '../payload/StartPayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/start/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/start/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/start/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/start/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/start/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/start/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (sensor: Sensor) => Action<StartPayload>;
|
||||||
|
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (sensor: Sensor): Action<StartPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
sensor: sensor,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensor,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -1,3 +1,42 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import Sensor from '../../api/model/Sensor';
|
||||||
*/
|
import StopPayload from '../payload/StopPayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/stop/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/stop/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/stop/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/stop/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/stop/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/stop/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (sensor: Sensor) => Action<StopPayload>;
|
||||||
|
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (sensor: Sensor): Action<StopPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
sensor: sensor,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensor,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
|
||||||
|
interface ItemReadAllBySensorPayload {
|
||||||
|
sensor: Sensor;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ItemReadAllBySensorPayload;
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
|
@ -1,3 +1,5 @@
|
||||||
/**
|
interface ItemReadPayload {
|
||||||
* Created by geek on 17. 7. 3.
|
id: string;
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
export default ItemReadPayload;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
/**
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
interface ItemRegistPayload {
|
||||||
|
sensorItem: SensorItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ItemRegistPayload;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
/**
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
interface ItemRemovePayload {
|
||||||
|
sensorItem: SensorItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ItemRemovePayload;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import Target from '@overflow/target/api/model/Target';
|
||||||
|
|
||||||
|
interface ReadAllByTargetPayload {
|
||||||
|
target: Target;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ReadAllByTargetPayload;
|
|
@ -1,3 +1,5 @@
|
||||||
/**
|
interface ReadPayload {
|
||||||
* Created by geek on 17. 7. 3.
|
id: string;
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
export default ReadPayload;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
/**
|
import Sensor from '../../api/model/Sensor';
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
interface RegistPayload {
|
||||||
|
sensor: Sensor;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default RegistPayload;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
/**
|
import Sensor from '../../api/model/Sensor';
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
interface RemovePayload {
|
||||||
|
sensor: Sensor;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default RemovePayload;
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
7
src/ts/@overflow/sensor/redux/payload/StartPayload.ts
Normal file
7
src/ts/@overflow/sensor/redux/payload/StartPayload.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
|
||||||
|
interface StartPayload {
|
||||||
|
sensor: Sensor;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StartPayload;
|
|
@ -1,3 +1,7 @@
|
||||||
/**
|
import Sensor from '../../api/model/Sensor';
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
interface StopPayload {
|
||||||
|
sensor: Sensor;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StopPayload;
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
|
import SensorItemService from '../../api/service/SensorItemService';
|
||||||
|
import * as ItemReadActions from '../action/item_read';
|
||||||
|
import ItemReadPayload from '../payload/ItemReadPayload';
|
||||||
|
|
||||||
|
function* readItem(action: Action<ItemReadPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {id} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorItemService>().read, id);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(ItemReadActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(ItemReadActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchReadItem(): SagaIterator {
|
||||||
|
yield takeLatest(ItemReadActions.REQUEST, readItem);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
|
import SensorItemService from '../../api/service/SensorItemService';
|
||||||
|
import * as ItemReadAllBySensorActions from '../action/item_read_all_by_sensor';
|
||||||
|
import ItemReadAllBySensorActionsPayload from '../payload/ItemReadAllBySensorPayload';
|
||||||
|
|
||||||
|
function* readAllItemBySensor(action: Action<ItemReadAllBySensorActionsPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {sensor} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorItemService>().readAllBySensor, sensor);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(ItemReadAllBySensorActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(ItemReadAllBySensorActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchReadAllItemBySensor(): SagaIterator {
|
||||||
|
yield takeLatest(ItemReadAllBySensorActions.REQUEST, readAllItemBySensor);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
|
import SensorItemService from '../../api/service/SensorItemService';
|
||||||
|
import * as ItemRegistActions from '../action/item_regist';
|
||||||
|
import ItemRegistPayload from '../payload/ItemRegistPayload';
|
||||||
|
|
||||||
|
function* registItem(action: Action<ItemRegistPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {sensorItem} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorItemService>().regist, sensorItem);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(ItemRegistActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(ItemRegistActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchRegistItem(): SagaIterator {
|
||||||
|
yield takeLatest(ItemRegistActions.REQUEST, registItem);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
|
import SensorItemService from '../../api/service/SensorItemService';
|
||||||
|
import * as ItemRemoveActions from '../action/item_remove';
|
||||||
|
import ItemRemovePayload from '../payload/ItemRemovePayload';
|
||||||
|
|
||||||
|
function* removeItem(action: Action<ItemRemovePayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {sensorItem} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
yield call(AppContext.getService<SensorItemService>().remove, sensorItem);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(ItemRemoveActions.requestSuccess());
|
||||||
|
} catch (e) {
|
||||||
|
yield put(ItemRemoveActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchRemoveItem(): SagaIterator {
|
||||||
|
yield takeLatest(ItemRemoveActions.REQUEST, removeItem);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import SensorService from '../../api/service/SensorService';
|
||||||
|
import * as ReadActions from '../action/read';
|
||||||
|
import ReadPayload from '../payload/ReadPayload';
|
||||||
|
|
||||||
|
function* read(action: Action<ReadPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {id} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorService>().read, id);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(ReadActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(ReadActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchRead(): SagaIterator {
|
||||||
|
yield takeLatest(ReadActions.REQUEST, read);
|
||||||
|
}
|
||||||
|
|
38
src/ts/@overflow/sensor/redux/saga/read_all_by_target.ts
Normal file
38
src/ts/@overflow/sensor/redux/saga/read_all_by_target.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { SagaIterator } from 'redux-saga';
|
||||||
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import SensorService from '../../api/service/SensorService';
|
||||||
|
import * as ReadAllByTargetActions from '../action/read_all_by_target';
|
||||||
|
import ReadAllByTargetPayload from '../payload/ReadAllByTargetPayload';
|
||||||
|
|
||||||
|
function* readAllByTarget(action: Action<ReadAllByTargetPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {target} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorService>().readAllByTarget, target);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(ReadAllByTargetActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(ReadAllByTargetActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchReadAllByTarget(): SagaIterator {
|
||||||
|
yield takeLatest(ReadAllByTargetActions.REQUEST, readAllByTarget);
|
||||||
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { SagaIterator } from 'redux-saga';
|
||||||
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import SensorService from '../../api/service/SensorService';
|
||||||
|
import * as RegistActions from '../action/regist';
|
||||||
|
import RegistPayload from '../payload/RegistPayload';
|
||||||
|
|
||||||
|
function* regist(action: Action<RegistPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {sensor} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorService>().regist, sensor);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(RegistActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(RegistActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchRegist(): SagaIterator {
|
||||||
|
yield takeLatest(RegistActions.REQUEST, regist);
|
||||||
|
}
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import SensorService from '../../api/service/SensorService';
|
||||||
|
import * as RemoveActions from '../action/remove';
|
||||||
|
import RemovePayload from '../payload/RemovePayload';
|
||||||
|
|
||||||
|
function* remove(action: Action<RemovePayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {sensor} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorService>().remove, sensor);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(RemoveActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(RemoveActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchRemove(): SagaIterator {
|
||||||
|
yield takeLatest(RemoveActions.REQUEST, remove);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import SensorService from '../../api/service/SensorService';
|
||||||
|
import * as StartActions from '../action/start';
|
||||||
|
import StartPayload from '../payload/StartPayload';
|
||||||
|
|
||||||
|
function* start(action: Action<StartPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {sensor} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorService>().start, sensor);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(StartActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(StartActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchStart(): SagaIterator {
|
||||||
|
yield takeLatest(StartActions.REQUEST, start);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import SensorService from '../../api/service/SensorService';
|
||||||
|
import * as StopActions from '../action/stop';
|
||||||
|
import StopPayload from '../payload/StopPayload';
|
||||||
|
|
||||||
|
function* stop(action: Action<StopPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {sensor} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retSensor = yield call(AppContext.getService<SensorService>().stop, sensor);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(StopActions.requestSuccess(retSensor));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(StopActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchStop(): SagaIterator {
|
||||||
|
yield takeLatest(StopActions.REQUEST, stop);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,43 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import Target from '../../api/model/Target';
|
||||||
*/
|
|
||||||
|
import ReadPayload from '../payload/ReadPayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/target/read/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/target/read/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (id: string) => Action<ReadPayload>;
|
||||||
|
export type requestSuccess = (target: Target) => Action<Target>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (id: string): Action<ReadPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (target: Target): Action<Target> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: target,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -4,13 +4,13 @@ import Probe from '@overflow/probe/api/model/Probe';
|
||||||
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
|
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
|
||||||
|
|
||||||
// Action Type
|
// Action Type
|
||||||
export type REQUEST = '@overflow/target/read/REQUEST';
|
export type REQUEST = '@overflow/target/read_all_by_probe/REQUEST';
|
||||||
export type REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
|
export type REQUEST_SUCCESS = '@overflow/target/read_all_by_probe/REQUEST_SUCCESS';
|
||||||
export type REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
|
export type REQUEST_FAILURE = '@overflow/target/read_all_by_probe/REQUEST_FAILURE';
|
||||||
|
|
||||||
export const REQUEST: REQUEST = '@overflow/target/read/REQUEST';
|
export const REQUEST: REQUEST = '@overflow/target/read_all_by_probe/REQUEST';
|
||||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/read_all_by_probe/REQUEST_SUCCESS';
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/read_all_by_probe/REQUEST_FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
// Action Creater
|
||||||
export type request = (probe: Probe) => Action<ReadAllByProbePayload>;
|
export type request = (probe: Probe) => Action<ReadAllByProbePayload>;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import Action from '@overflow/commons/redux/Action';
|
import Action from '@overflow/commons/redux/Action';
|
||||||
import Target from '../../api/model/Target';
|
import Target from '../../api/model/Target';
|
||||||
import RegistPayload from '../payload/RegistPayload';
|
import RegistPayload from '../payload/RegistPayload';
|
||||||
import Infra from '@overflow/infra/api/model/Infra';
|
|
||||||
import Probe from '@overflow/probe/api/model/Probe';
|
|
||||||
|
|
||||||
// Action Type
|
// Action Type
|
||||||
export type REQUEST = '@overflow/target/regist/REQUEST';
|
export type REQUEST = '@overflow/target/regist/REQUEST';
|
||||||
|
|
|
@ -3,13 +3,13 @@ import Target from '../../api/model/Target';
|
||||||
import RemovePayload from '../payload/RemovePayload';
|
import RemovePayload from '../payload/RemovePayload';
|
||||||
|
|
||||||
// Action Type
|
// Action Type
|
||||||
export type REQUEST = '@overflow/target/regist/REQUEST';
|
export type REQUEST = '@overflow/target/remove/REQUEST';
|
||||||
export type REQUEST_SUCCESS = '@overflow/target/regist/REQUEST_SUCCESS';
|
export type REQUEST_SUCCESS = '@overflow/target/remove/REQUEST_SUCCESS';
|
||||||
export type REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
|
export type REQUEST_FAILURE = '@overflow/target/remove/REQUEST_FAILURE';
|
||||||
|
|
||||||
export const REQUEST: REQUEST = '@overflow/target/regist/REQUEST';
|
export const REQUEST: REQUEST = '@overflow/target/remove/REQUEST';
|
||||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/regist/REQUEST_SUCCESS';
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/remove/REQUEST_SUCCESS';
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/remove/REQUEST_FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
// Action Creater
|
||||||
export type request = (target: Target) => Action<RemovePayload>;
|
export type request = (target: Target) => Action<RemovePayload>;
|
||||||
|
@ -27,10 +27,9 @@ export const request: request = (target: Target): Action<RemovePayload> => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestSuccess: requestSuccess = (target: Target): Action<Target> => {
|
export const requestSuccess: requestSuccess = (): Action<void> => {
|
||||||
return {
|
return {
|
||||||
type: REQUEST_SUCCESS,
|
type: REQUEST_SUCCESS,
|
||||||
payload: target,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,22 +9,22 @@ import TargetService from '../../api/service/TargetService';
|
||||||
import * as ReadActions from '../action/read';
|
import * as ReadActions from '../action/read';
|
||||||
import ReadPayload from '../payload/ReadPayload';
|
import ReadPayload from '../payload/ReadPayload';
|
||||||
|
|
||||||
function* read(action: Action<RegistPayload>): SagaIterator {
|
function* read(action: Action<ReadPayload>): SagaIterator {
|
||||||
try {
|
try {
|
||||||
const {target} = action.payload;
|
const {id} = action.payload;
|
||||||
// yield put({
|
// yield put({
|
||||||
// type: types.SENDING_REQUEST,
|
// type: types.SENDING_REQUEST,
|
||||||
// payload: {sendingRequest: true},
|
// payload: {sendingRequest: true},
|
||||||
// });
|
// });
|
||||||
|
|
||||||
const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
|
const retTarget = yield call(AppContext.getService<TargetService>().read, id);
|
||||||
|
|
||||||
// if (responseBody.token === undefined) {
|
// if (responseBody.token === undefined) {
|
||||||
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
// }
|
// }
|
||||||
yield put(RegistActions.requestSuccess(retTarget));
|
yield put(ReadActions.requestSuccess(retTarget));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
yield put(RegistActions.requestFailure(e));
|
yield put(ReadActions.requestFailure(e));
|
||||||
} finally {
|
} finally {
|
||||||
// yield put({
|
// yield put({
|
||||||
// type: types.SENDING_REQUEST,
|
// type: types.SENDING_REQUEST,
|
||||||
|
@ -33,6 +33,6 @@ function* read(action: Action<RegistPayload>): SagaIterator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* watchSignin(): SagaIterator {
|
export function* watchRead(): SagaIterator {
|
||||||
yield takeLatest(RegistActions.REQUEST, regist);
|
yield takeLatest(ReadActions.REQUEST, read);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,22 +9,22 @@ import TargetService from '../../api/service/TargetService';
|
||||||
import * as ReadAllByProbeActions from '../action/read_all_by_probe';
|
import * as ReadAllByProbeActions from '../action/read_all_by_probe';
|
||||||
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
|
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
|
||||||
|
|
||||||
function* regist(action: Action<RegistPayload>): SagaIterator {
|
function* readAllByProbe(action: Action<ReadAllByProbePayload>): SagaIterator {
|
||||||
try {
|
try {
|
||||||
const {target} = action.payload;
|
const {probe} = action.payload;
|
||||||
// yield put({
|
// yield put({
|
||||||
// type: types.SENDING_REQUEST,
|
// type: types.SENDING_REQUEST,
|
||||||
// payload: {sendingRequest: true},
|
// payload: {sendingRequest: true},
|
||||||
// });
|
// });
|
||||||
|
|
||||||
const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
|
const retTargets = yield call(AppContext.getService<TargetService>().readAllByProbe, probe);
|
||||||
|
|
||||||
// if (responseBody.token === undefined) {
|
// if (responseBody.token === undefined) {
|
||||||
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
// }
|
// }
|
||||||
yield put(RegistActions.requestSuccess(retTarget));
|
yield put(ReadAllByProbeActions.requestSuccess(retTargets));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
yield put(RegistActions.requestFailure(e));
|
yield put(ReadAllByProbeActions.requestFailure(e));
|
||||||
} finally {
|
} finally {
|
||||||
// yield put({
|
// yield put({
|
||||||
// type: types.SENDING_REQUEST,
|
// type: types.SENDING_REQUEST,
|
||||||
|
@ -33,6 +33,6 @@ function* regist(action: Action<RegistPayload>): SagaIterator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* watchSignin(): SagaIterator {
|
export function* watchReadAllByProbe(): SagaIterator {
|
||||||
yield takeLatest(RegistActions.REQUEST, regist);
|
yield takeLatest(ReadAllByProbeActions.REQUEST, readAllByProbe);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@ function* regist(action: Action<RegistPayload>): SagaIterator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* watchSignin(): SagaIterator {
|
export function* watchRegist(): SagaIterator {
|
||||||
yield takeLatest(RegistActions.REQUEST, regist);
|
yield takeLatest(RegistActions.REQUEST, regist);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Target from '../../api/model/Target';
|
||||||
|
import TargetService from '../../api/service/TargetService';
|
||||||
|
import * as RemoveActions from '../action/remove';
|
||||||
|
import RemovePayload from '../payload/RemovePayload';
|
||||||
|
|
||||||
|
function* remove(action: Action<RemovePayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {target} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
yield call(AppContext.getService<TargetService>().remove, target);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(RemoveActions.requestSuccess());
|
||||||
|
} catch (e) {
|
||||||
|
yield put(RemoveActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchRemove(): SagaIterator {
|
||||||
|
yield takeLatest(RemoveActions.REQUEST, remove);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user