This commit is contained in:
insanity 2017-07-04 13:14:50 +09:00
parent 513a3a1056
commit dd4448524d
2 changed files with 54 additions and 3 deletions

View File

@ -0,0 +1,45 @@
import Action from '@overflow/commons/redux/Action';
import Target from '../../api/model/Target';
import RegistPayload from '../payload/RegistPayload';
import Infra from '@overflow/infra/api/model/Infra';
import Probe from '@overflow/probe/api/model/Probe';
// 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 = (probe: Probe, infra: Infra) => 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> => {
return {
type: REQUEST,
payload: {
probe: probe,
infra: infra,
},
};
};
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

@ -1,3 +1,9 @@
/**
* Created by geek on 17. 7. 3.
*/
import Infra from '@overflow/infra/api/model/Infra';
import Probe from '@overflow/probe/api/model/Probe';
interface RegistPayload {
infra: Infra;
probe: Probe;
}
export default RegistPayload;