Merge remote-tracking branch 'origin/master'

This commit is contained in:
geek 2017-07-04 16:00:55 +09:00
commit 3e79487f8f
68 changed files with 744 additions and 50 deletions

View File

@ -1,5 +1,6 @@
import Service from '@overflow/commons/api/Service';
import ApiKey from '../model/ApiKey';
import Domain from '@overflow/domain/api/model/Domain';
class ApiKeyService extends Service {
@ -12,6 +13,10 @@ class ApiKeyService extends Service {
return null;
}
public read(domain: Domain): ApiKey {
return null;
}
}

View File

@ -0,0 +1,44 @@
import Action from '@overflow/commons/redux/Action';
import ApiKey from '../..//api/model/ApiKey';
import Domain from '@overflow/domain/api/model/Domain';
import ReadPayload from '../payload/ReadPayload';
// Action Type
export type REQUEST = '@overflow/apikey/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/apikey/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/apikey/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/apikey/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/apikey/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/apikey/read/REQUEST_FAILURE';
// Action Creater
export type request = (domain: Domain) => Action<ReadPayload>;
export type requestSuccess = (apiKey: ApiKey) => Action<ApiKey>;
export type requestFailure = (error: Error) => Action;
export const request: request = (domain: Domain): Action<ReadPayload> => {
return {
type: REQUEST,
payload: {
domain:domain,
},
};
};
export const requestSuccess: requestSuccess = (apiKey: ApiKey): Action<ApiKey> => {
return {
type: REQUEST_SUCCESS,
payload: apiKey,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,9 @@
import Domain from '@overflow/domain/api/model/Domain';
interface ReadPayload {
domain: Domain;
}
export default ReadPayload;

View File

@ -0,0 +1,39 @@
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 ApiKey from '../../api/model/ApiKey';
import ApiKeyService from '../../api/service/ApiKeyService';
import * as ReadActions from '../action/read';
import ReadPayload from '../payload/ReadPayload';
function* read(action: Action<ReadPayload>): SagaIterator {
try {
const {domain} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<ApiKeyService>().read, domain);
// if (responseBody.token === undefined) {
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
// }
yield put(ReadActions.requestSuccess(retApikey));
} catch (e) {
yield put(ReadActions.requestFailure(e));
} finally {
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: false},
// });
}
}
export function* watchSignin(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import InfraHost from '../..//api/model/InfraHost';
import HostRegistPayload from '../payload/HostRegistPayload';
// Action Type
export type REQUEST = '@overflow/infraHost/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraHost/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraHost/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraHost/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraHost/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraHost/regist/REQUEST_FAILURE';
// Action Creater
export type request = (infraHost: InfraHost) => Action<HostRegistPayload>;
export type requestSuccess = (infraHost: InfraHost) => Action<InfraHost>;
export type requestFailure = (error: Error) => Action;
export const request: request = (infraHost: InfraHost): Action<HostRegistPayload> => {
return {
type: REQUEST,
payload: {
infraHost:infraHost,
},
};
};
export const requestSuccess: requestSuccess = (infraHost: InfraHost): Action<InfraHost> => {
return {
type: REQUEST_SUCCESS,
payload: infraHost,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import InfraMachine from '../..//api/model/InfraMachine';
import MachineRegistPayload from '../payload/MachineRegistPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
// Action Creater
export type request = (infraMachine: InfraMachine) => Action<MachineRegistPayload>;
export type requestSuccess = (infraMachine: InfraMachine) => Action<InfraMachine>;
export type requestFailure = (error: Error) => Action;
export const request: request = (infraMachine: InfraMachine): Action<MachineRegistPayload> => {
return {
type: REQUEST,
payload: {
infraMachine:infraMachine,
},
};
};
export const requestSuccess: requestSuccess = (infraMachine: InfraMachine): Action<InfraMachine> => {
return {
type: REQUEST_SUCCESS,
payload: infraMachine,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import InfraOSApplication from '../..//api/model/InfraOSApplication';
import OSApplicationRegistPayload from '../payload/OSApplicationRegistPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
// Action Creater
export type request = (infraOSApplication: InfraOSApplication) => Action<OSApplicationRegistPayload>;
export type requestSuccess = (infraOSApplication: InfraOSApplication) => Action<InfraOSApplication>;
export type requestFailure = (error: Error) => Action;
export const request: request = (infraOSApplication: InfraOSApplication): Action<OSApplicationRegistPayload> => {
return {
type: REQUEST,
payload: {
infraOSApplication:infraOSApplication,
},
};
};
export const requestSuccess: requestSuccess = (infraOSApplication: InfraOSApplication): Action<InfraOSApplication> => {
return {
type: REQUEST_SUCCESS,
payload: infraOSApplication,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import InfraOSDaemon from '../..//api/model/InfraOSDaemon';
import OSDaemonRegistPayload from '../payload/OSDaemonRegistPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
// Action Creater
export type request = (infraOSDaemon: InfraOSDaemon) => Action<OSDaemonRegistPayload>;
export type requestSuccess = (infraOSDaemon: InfraOSDaemon) => Action<InfraOSDaemon>;
export type requestFailure = (error: Error) => Action;
export const request: request = (infraOSDaemon: InfraOSDaemon): Action<OSDaemonRegistPayload> => {
return {
type: REQUEST,
payload: {
infraOSDaemon:infraOSDaemon,
},
};
};
export const requestSuccess: requestSuccess = (infraOSDaemon: InfraOSDaemon): Action<InfraOSDaemon> => {
return {
type: REQUEST_SUCCESS,
payload: infraOSDaemon,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import InfraOSPort from '../..//api/model/InfraOSPort';
import OSPortRegistPayload from '../payload/OSPortRegistPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
// Action Creater
export type request = (infraOSPort: InfraOSPort) => Action<OSPortRegistPayload>;
export type requestSuccess = (infraOSPort: InfraOSPort) => Action<InfraOSPort>;
export type requestFailure = (error: Error) => Action;
export const request: request = (infraOSPort: InfraOSPort): Action<OSPortRegistPayload> => {
return {
type: REQUEST,
payload: {
infraOSPort:infraOSPort,
},
};
};
export const requestSuccess: requestSuccess = (infraOSPort: InfraOSPort): Action<InfraOSPort> => {
return {
type: REQUEST_SUCCESS,
payload: infraOSPort,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import InfraOS from '../..//api/model/InfraOS';
import OSRegistPayload from '../payload/OSRegistPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
// Action Creater
export type request = (infraOS: InfraOS) => Action<OSRegistPayload>;
export type requestSuccess = (infraOS: InfraOS) => Action<InfraOS>;
export type requestFailure = (error: Error) => Action;
export const request: request = (infraOS: InfraOS): Action<OSRegistPayload> => {
return {
type: REQUEST,
payload: {
infraOS:infraOS,
},
};
};
export const requestSuccess: requestSuccess = (infraOS: InfraOS): Action<InfraOS> => {
return {
type: REQUEST_SUCCESS,
payload: infraOS,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import Infra from '../..//api/model/Infra';
import RegistPayload from '../payload/RegistPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
// Action Creater
export type request = (infra: Infra) => Action<RegistPayload>;
export type requestSuccess = (infra: Infra) => Action<Infra>;
export type requestFailure = (error: Error) => Action;
export const request: request = (infra: Infra): Action<RegistPayload> => {
return {
type: REQUEST,
payload: {
infra:infra,
},
};
};
export const requestSuccess: requestSuccess = (infra: Infra): Action<Infra> => {
return {
type: REQUEST_SUCCESS,
payload: infra,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import InfraService from '../..//api/model/InfraService';
import ServiceRegistPayload from '../payload/ServiceRegistPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/regist/REQUEST_FAILURE';
// Action Creater
export type request = (infraService: InfraService) => Action<ServiceRegistPayload>;
export type requestSuccess = (infraService: InfraService) => Action<InfraService>;
export type requestFailure = (error: Error) => Action;
export const request: request = (infraService: InfraService): Action<ServiceRegistPayload> => {
return {
type: REQUEST,
payload: {
infraService:infraService,
},
};
};
export const requestSuccess: requestSuccess = (infraService: InfraService): Action<InfraService> => {
return {
type: REQUEST_SUCCESS,
payload: infraService,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,7 @@
interface HostReadPayload {
id: number;
}
export default HostReadPayload;

View File

@ -1,7 +1,7 @@
import InfraHost from '../../api/model/InfraHost';
interface InfraHostRegistPayload {
interface HostRegistPayload {
infraHost: InfraHost;
}
export default InfraHostRegistPayload;
export default HostRegistPayload;

View File

@ -1,7 +0,0 @@
import Infra from '../../api/model/Infra';
interface InfraRegistPayload {
infra: Infra;
}
export default InfraRegistPayload;

View File

@ -0,0 +1,7 @@
interface MachineReadPayload {
id: number;
}
export default MachineReadPayload;

View File

@ -2,8 +2,8 @@
import InfraMachine from '../../api/model/InfraMachine';
interface InfraMachineRegistPayload {
interface MachineRegistPayload {
infraMachine: InfraMachine;
}
export default InfraMachineRegistPayload;
export default MachineRegistPayload;

View File

@ -0,0 +1,7 @@
interface OSApplicationReadPayload {
id: number;
}
export default OSApplicationReadPayload;

View File

@ -1,7 +1,7 @@
import InfraOSApplication from '../../api/model/InfraOSApplication';
interface InfraOSApplicationRegistPayload {
interface OSApplicationRegistPayload {
infraOSApplication: InfraOSApplication;
}
export default InfraOSApplicationRegistPayload;
export default OSApplicationRegistPayload;

View File

@ -0,0 +1,7 @@
interface OSDaemonReadPayload {
id: number;
}
export default OSDaemonReadPayload;

View File

@ -1,7 +1,7 @@
import InfraOSDaemon from '../../api/model/InfraOSDaemon';
interface InfraOSDaemonRegistPayload {
interface OSDaemonRegistPayload {
infraOSDaemon: InfraOSDaemon;
}
export default InfraOSDaemonRegistPayload;
export default OSDaemonRegistPayload;

View File

@ -0,0 +1,7 @@
interface OSPortReadPayload {
id: number;
}
export default OSPortReadPayload;

View File

@ -1,7 +1,7 @@
import InfraOSPort from '../../api/model/InfraOSPort';
interface InfraOSPortRegistPayload {
interface OSPortRegistPayload {
infraOSPort: InfraOSPort;
}
export default InfraOSPortRegistPayload;
export default OSPortRegistPayload;

View File

@ -0,0 +1,7 @@
interface OSReadPayload {
id: number;
}
export default OSReadPayload;

View File

@ -1,7 +1,7 @@
import InfraOS from '../../api/model/InfraOS';
interface InfraOSRegistPayload {
interface OSRegistPayload {
infraOS: InfraOS;
}
export default InfraOSRegistPayload;
export default OSRegistPayload;

View File

@ -0,0 +1,7 @@
interface ReadPayload {
id: number;
}
export default ReadPayload;

View File

@ -0,0 +1,7 @@
import Infra from '../../api/model/Infra';
interface RegistPayload {
infra: Infra;
}
export default RegistPayload;

View File

@ -0,0 +1,7 @@
interface ServiceReadPayload {
id: number;
}
export default ServiceReadPayload;

View File

@ -1,7 +1,7 @@
import InfraService from '../../api/model/InfraService';
interface InfraServiceRegistPayload {
interface ServiceRegistPayload {
infraService: InfraService;
}
export default InfraServiceRegistPayload;
export default ServiceRegistPayload;

View File

@ -23,7 +23,7 @@ export class TargetService extends Service {
});
}
public readByProbe(probe:Probe): Promise<Target> {
public readAllByProbe(probe:Probe): Promise<Target[]> {
return null;
}

View File

@ -1,3 +0,0 @@
/**
* Created by geek on 17. 7. 3.
*/

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import Target from '../../api/model/Target';
import Probe from '@overflow/probe/api/model/Probe';
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
// 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 = (probe: Probe) => Action<ReadAllByProbePayload>;
export type requestSuccess = (targets: Target[]) => Action<Target[]>;
export type requestFailure = (error: Error) => Action;
export const request: request = (probe: Probe): Action<ReadAllByProbePayload> => {
return {
type: REQUEST,
payload: {
probe: probe,
},
};
};
export const requestSuccess: requestSuccess = (targets: Target[]): Action<Target[]> => {
return {
type: REQUEST_SUCCESS,
payload: targets,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -14,26 +14,25 @@ export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/regist/REQUEST
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
// Action Creater
export type request = (probe: Probe, infra: Infra) => Action<RegistPayload>;
export type request = (target: Target) => Action<RegistPayload>;
export type requestSuccess = (target: Target) => Action<Target>;
export type requestFailure = (error: Error) => Action;
export const request: request = (probe: Probe, infra: Infra): Action<RegistPayload> => {
export const request: request = (target: Target): Action<RegistPayload> => {
return {
type: REQUEST,
payload: {
probe: probe,
infra: infra,
target: target,
},
};
};
export const requestSuccess: requestSuccess = (apiKey: ApiKey): Action<ApiKey> => {
export const requestSuccess: requestSuccess = (target: Target): Action<Target> => {
return {
type: REQUEST_SUCCESS,
payload: apiKey,
payload: target,
};
};

View File

@ -1,3 +1,42 @@
/**
* Created by geek on 17. 7. 3.
*/
import Action from '@overflow/commons/redux/Action';
import Target from '../../api/model/Target';
import RemovePayload from '../payload/RemovePayload';
// Action Type
export type REQUEST = '@overflow/target/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/target/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/target/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
// Action Creater
export type request = (target: Target) => Action<RemovePayload>;
export type requestSuccess = () => Action<void>;
export type requestFailure = (error: Error) => Action;
export const request: request = (target: Target): Action<RemovePayload> => {
return {
type: REQUEST,
payload: {
target: target,
},
};
};
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,
};
};

View File

@ -0,0 +1,7 @@
import Probe from '@overflow/probe/api/model/Probe';
interface ReadAllByProbePayload {
probe: Probe;
}
export default ReadAllByProbePayload;

View File

@ -1,3 +0,0 @@
/**
* Created by geek on 17. 7. 3.
*/

View File

@ -0,0 +1,5 @@
interface ReadPayload {
id: string;
}
export default ReadPayload;

View File

@ -1,9 +1,7 @@
import Infra from '@overflow/infra/api/model/Infra';
import Probe from '@overflow/probe/api/model/Probe';
import Target from '../../api/model/Target';
interface RegistPayload {
infra: Infra;
probe: Probe;
target: Target;
}
export default RegistPayload;

View File

@ -1,3 +0,0 @@
/**
* Created by geek on 17. 7. 3.
*/

View File

@ -0,0 +1,7 @@
import Target from '../../api/model/Target';
interface RemovePayload {
target: Target;
}
export default RemovePayload;

View File

@ -1,3 +1,38 @@
/**
* Created by geek on 17. 7. 3.
*/
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 Target from '../../api/model/Target';
import TargetService from '../../api/service/TargetService';
import * as ReadActions from '../action/read';
import ReadPayload from '../payload/ReadPayload';
function* read(action: Action<RegistPayload>): SagaIterator {
try {
const {target} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
// if (responseBody.token === undefined) {
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
// }
yield put(RegistActions.requestSuccess(retTarget));
} catch (e) {
yield put(RegistActions.requestFailure(e));
} finally {
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: false},
// });
}
}
export function* watchSignin(): SagaIterator {
yield takeLatest(RegistActions.REQUEST, regist);
}

View 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 Target from '../../api/model/Target';
import TargetService from '../../api/service/TargetService';
import * as ReadAllByProbeActions from '../action/read_all_by_probe';
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
function* regist(action: Action<RegistPayload>): SagaIterator {
try {
const {target} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
// if (responseBody.token === undefined) {
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
// }
yield put(RegistActions.requestSuccess(retTarget));
} catch (e) {
yield put(RegistActions.requestFailure(e));
} finally {
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: false},
// });
}
}
export function* watchSignin(): SagaIterator {
yield takeLatest(RegistActions.REQUEST, regist);
}

View File

@ -1,3 +0,0 @@
/**
* Created by geek on 17. 7. 3.
*/

View 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 Target from '../../api/model/Target';
import TargetService from '../../api/service/TargetService';
import * as RegistActions from '../action/regist';
import RegistPayload from '../payload/RegistPayload';
function* regist(action: Action<RegistPayload>): SagaIterator {
try {
const {target} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
// if (responseBody.token === undefined) {
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
// }
yield put(RegistActions.requestSuccess(retTarget));
} catch (e) {
yield put(RegistActions.requestFailure(e));
} finally {
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: false},
// });
}
}
export function* watchSignin(): SagaIterator {
yield takeLatest(RegistActions.REQUEST, regist);
}