|
|
|
@ -54,9 +54,9 @@ const CLIENT_MAPTYPE = 'sample/CLIENT_MAPTYPE';
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
export const getDroneList = createAsyncAction( |
|
|
|
|
GET_DRONE_LIST_REQUEST, |
|
|
|
|
GET_DRONE_LIST_SUCCESS, |
|
|
|
|
GET_DRONE_LIST_FAILURE |
|
|
|
|
GET_DRONE_LIST_REQUEST, |
|
|
|
|
GET_DRONE_LIST_SUCCESS, |
|
|
|
|
GET_DRONE_LIST_FAILURE |
|
|
|
|
)(); |
|
|
|
|
|
|
|
|
|
export const clientMapType = createAction(CLIENT_MAPTYPE)(); |
|
|
|
@ -72,9 +72,9 @@ export const clientMapType = createAction(CLIENT_MAPTYPE)();
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
export const sampleAPI = { |
|
|
|
|
getDroneList: async () => { |
|
|
|
|
return await axios.get('api/bas/dron/list....'); |
|
|
|
|
} |
|
|
|
|
getDroneList: async () => { |
|
|
|
|
return await axios.get('api/bas/dron/list....'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
@ -89,23 +89,23 @@ export const sampleAPI = {
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
export const initSample: ISampleState = { |
|
|
|
|
droneList: undefined, |
|
|
|
|
droneCount: 0 |
|
|
|
|
droneList: undefined, |
|
|
|
|
droneCount: 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface ISampleState { |
|
|
|
|
droneList: IDrone[] | undefined; |
|
|
|
|
droneCount: number | 0; |
|
|
|
|
droneList: IDrone[] | undefined; |
|
|
|
|
droneCount: number | 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface IDrone { |
|
|
|
|
groupId: string; |
|
|
|
|
arcrftSno: number; |
|
|
|
|
.... |
|
|
|
|
groupId: string; |
|
|
|
|
arcrftSno: number; |
|
|
|
|
.... |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface IUpdateDroneRq { |
|
|
|
|
... |
|
|
|
|
... |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
@ -117,9 +117,9 @@ export interface IUpdateDroneRq {
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
export const sampleReducer = createReducer<ISampleState, Actions.SampleActions>( |
|
|
|
|
initSample |
|
|
|
|
initSample |
|
|
|
|
).handleAction(Actions.getDroneList.success, (state, action) => |
|
|
|
|
produce(state, draft => {}) |
|
|
|
|
produce(state, draft => {}) |
|
|
|
|
); |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
@ -131,10 +131,10 @@ export const sampleReducer = createReducer<ISampleState, Actions.SampleActions>(
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
function* getDroneListSaga( |
|
|
|
|
action: ActionType<typeof Actions.getDroneList.request> |
|
|
|
|
action: ActionType<typeof Actions.getDroneList.request> |
|
|
|
|
) { |
|
|
|
|
try { |
|
|
|
|
} catch (error: any) {} |
|
|
|
|
try { |
|
|
|
|
} catch (error: any) {} |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
@ -142,7 +142,7 @@ function* getDroneListSaga(
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
export function* sampleSaga() { |
|
|
|
|
yield takeEvery(Actions.getDroneList.request, getDroneListSaga); |
|
|
|
|
yield takeEvery(Actions.getDroneList.request, getDroneListSaga); |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|