s
This commit is contained in:
parent
2d1338e0a7
commit
ed49b5ecdf
|
@ -5,26 +5,26 @@ import AppContext from '@overflow/commons/context';
|
||||||
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 TargetService from '../../api/service/TargetService';
|
import TargetDiscoveryService from '../../api/service/TargetDiscoveryService';
|
||||||
import * as RegistActions from '../action/regist';
|
import * as RegistDiscoveredTargetActions from '../action/regist_discovered_target';
|
||||||
import RegistPayload from '../payload/RegistPayload';
|
import RegistDiscoveredTargetPayload from '../payload/RegistDiscoveredTargetPayload';
|
||||||
|
|
||||||
function* registDiscoveredTarget(action: Action<RegistPayload>): SagaIterator {
|
function* registDiscoveredTarget(action: Action<RegistDiscoveredTargetPayload>): SagaIterator {
|
||||||
try {
|
try {
|
||||||
const {target} = action.payload;
|
const {hosts, 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);
|
yield call(AppContext.getService<TargetDiscoveryService>().saveAllTarget, hosts, 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(RegistDiscoveredTargetActions.requestSuccess());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
yield put(RegistActions.requestFailure(e));
|
yield put(RegistDiscoveredTargetActions.requestFailure(e));
|
||||||
} finally {
|
} finally {
|
||||||
// yield put({
|
// yield put({
|
||||||
// type: types.SENDING_REQUEST,
|
// type: types.SENDING_REQUEST,
|
||||||
|
@ -33,6 +33,6 @@ function* registDiscoveredTarget(action: Action<RegistPayload>): SagaIterator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* watchRegist(): SagaIterator {
|
export function* watchRegistDiscoveredTarget(): SagaIterator {
|
||||||
yield takeLatest(RegistActions.REQUEST, regist);
|
yield takeLatest(RegistDiscoveredTargetActions.REQUEST, registDiscoveredTarget);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user