added saga

This commit is contained in:
snoop 2017-07-04 16:48:55 +09:00
parent ebe4703c01
commit 0eb8252e8d
34 changed files with 970 additions and 2 deletions

View File

@ -34,6 +34,6 @@ function* read(action: Action<ReadPayload>): SagaIterator {
}
}
export function* watchSignin(): SagaIterator {
export function* watchRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

View File

@ -34,6 +34,6 @@ function* regist(action: Action<RegistPayload>): SagaIterator {
}
}
export function* watchSignin(): SagaIterator {
export function* watchRegist(): SagaIterator {
yield takeLatest(RegistActions.REQUEST, regist);
}

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import InfraHost from '../..//api/model/InfraHost';
import HostReadPayload from '../payload/HostReadPayload';
// Action Type
export type REQUEST = '@overflow/infraHost/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraHost/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraHost/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraHost/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraHost/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraHost/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<HostReadPayload>;
export type requestSuccess = (infraHost: InfraHost) => Action<InfraHost>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<HostReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
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 MachineReadPayload from '../payload/MachineReadPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<MachineReadPayload>;
export type requestSuccess = (infraMachine: InfraMachine) => Action<InfraMachine>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<MachineReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
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 OSApplicationReadPayload from '../payload/OSApplicationReadPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<OSApplicationReadPayload>;
export type requestSuccess = (infraOSApplication: InfraOSApplication) => Action<InfraOSApplication>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<OSApplicationReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
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 OSDaemonReadPayload from '../payload/OSDaemonReadPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<OSDaemonReadPayload>;
export type requestSuccess = (infraOSDaemon: InfraOSDaemon) => Action<InfraOSDaemon>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<OSDaemonReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
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 OSPortReadPayload from '../payload/OSPortReadPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<OSPortReadPayload>;
export type requestSuccess = (infraOSPort: InfraOSPort) => Action<InfraOSPort>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<OSPortReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
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 OSReadPayload from '../payload/OSReadPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<OSReadPayload>;
export type requestSuccess = (infraOS: InfraOS) => Action<InfraOS>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<OSReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
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 ReadPayload from '../payload/ReadPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<ReadPayload>;
export type requestSuccess = (infra: Infra) => Action<Infra>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<ReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
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 ServiceReadPayload from '../payload/ServiceReadPayload';
// Action Type
export type REQUEST = '@overflow/infraMachine/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/infraMachine/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/infraMachine/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/infraMachine/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<ServiceReadPayload>;
export type requestSuccess = (infraService: InfraService) => Action<InfraService>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<ServiceReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
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,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 InfraHost from '../../api/model/InfraHost';
import InfraHostService from '../../api/service/InfraHostService';
import * as ReadActions from '../action/host_read';
import HostReadPayload from '../payload/HostReadPayload';
function* read(action: Action<HostReadPayload>): SagaIterator {
try {
const {id} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<InfraHostService>().read, id);
// 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* watchHostRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

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

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 InfraMachine from '../../api/model/InfraMachine';
import InfraMachineService from '../../api/service/InfraMachineService';
import * as ReadActions from '../action/machine_read';
import MachineReadPayload from '../payload/MachineReadPayload';
function* read(action: Action<MachineReadPayload>): SagaIterator {
try {
const {id} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<InfraMachineService>().read, id);
// 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* watchMachineRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

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

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 InfraOSApplication from '../../api/model/InfraOSApplication';
import InfraOSApplicationService from '../../api/service/InfraOSApplicationService';
import * as ReadActions from '../action/os_application_read';
import OSApplicationReadPayload from '../payload/OSApplicationReadPayload';
function* read(action: Action<OSApplicationReadPayload>): SagaIterator {
try {
const {id} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<InfraOSApplicationService>().read, id);
// 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* watchOSApplicationRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

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

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 InfraOSDaemon from '../../api/model/InfraOSDaemon';
import InfraOSDaemonService from '../../api/service/InfraOSDaemonService';
import * as ReadActions from '../action/os_daemon_read';
import OSDaemonReadPayload from '../payload/OSDaemonReadPayload';
function* read(action: Action<OSDaemonReadPayload>): SagaIterator {
try {
const {id} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<InfraOSDaemonService>().read, id);
// 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* watchOSDaemonRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

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

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 InfraOSPort from '../../api/model/InfraOSPort';
import InfraOSPortService from '../../api/service/InfraOSPortService';
import * as ReadActions from '../action/os_port_read';
import OSPortReadPayload from '../payload/OSPortReadPayload';
function* read(action: Action<OSPortReadPayload>): SagaIterator {
try {
const {id} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<InfraOSPortService>().read, id);
// 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* watchOSPortRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

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

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 InfraOS from '../../api/model/InfraOS';
import InfraOSService from '../../api/service/InfraOSService';
import * as ReadActions from '../action/os_read';
import OSReadPayload from '../payload/OSReadPayload';
function* read(action: Action<OSReadPayload>): SagaIterator {
try {
const {id} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<InfraOSService>().read, id);
// 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* watchOSRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

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

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 Infra from '../../api/model/Infra';
import InfraService from '../../api/service/InfraService';
import * as ReadActions from '../action/os_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 retApikey = yield call(AppContext.getService<InfraService>().read, id);
// 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* watchRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

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 Infra from '../../api/model/Infra';
import InfraService from '../../api/service/InfraService';
import * as RegistActions from '../action/os_regist';
import RegistPayload from '../payload/RegistPayload';
function* regist(action: Action<RegistPayload>): SagaIterator {
try {
const {infra} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<InfraService>().regist, infra);
// if (responseBody.token === undefined) {
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
// }
yield put(RegistActions.requestSuccess(retApikey));
} 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);
}

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 InfraService from '../../api/model/InfraService';
import InfraServiceService from '../../api/service/InfraServiceService';
import * as ReadActions from '../action/service_read';
import ServiceReadPayload from '../payload/ServiceReadPayload';
function* read(action: Action<ServiceReadPayload>): SagaIterator {
try {
const {id} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<InfraServiceService>().read, id);
// 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* watchServiceRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

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