2017-07-18 12:53:53 +08:00
|
|
|
import {
|
2017-07-19 15:12:10 +08:00
|
|
|
FETCH_ADD_INTERFACE_INPUT,
|
|
|
|
FETCH_ADD_INTERFACE_TAG_VALUE,
|
|
|
|
FETCH_ADD_INTERFACE_HEADER_VALUE,
|
|
|
|
ADD_INTERFACE_SEQ_HEADER,
|
|
|
|
DELETE_INTERFACE_SEQ_HEADER,
|
2017-07-20 14:48:29 +08:00
|
|
|
GET_INTERFACE_REQ_PARAMS,
|
|
|
|
GET_INTERFACE_RES_PARAMS,
|
2017-07-20 16:34:46 +08:00
|
|
|
SAVE_INTERFACE_FORMS,
|
2017-07-20 16:57:21 +08:00
|
|
|
PUSH_INTERFACE_NAME,
|
|
|
|
PUSH_INTERFACE_METHOD
|
2017-07-18 12:53:53 +08:00
|
|
|
} from '../../constants/action-types.js'
|
|
|
|
|
|
|
|
const initialState = {
|
2017-07-19 15:12:10 +08:00
|
|
|
inputValue: '',
|
|
|
|
tagValue: '',
|
|
|
|
headerValue: '',
|
2017-07-20 17:20:30 +08:00
|
|
|
method: '',
|
2017-07-19 15:12:10 +08:00
|
|
|
// 默认请求头部有一条数据
|
|
|
|
seqGroup: [
|
|
|
|
{
|
|
|
|
id: 0,
|
|
|
|
tag: '',
|
|
|
|
content: ''
|
|
|
|
}
|
|
|
|
],
|
2017-07-20 14:48:29 +08:00
|
|
|
reqParams: '',
|
|
|
|
resParams: ''
|
2017-07-18 12:53:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default (state = initialState, action) => {
|
|
|
|
switch (action.type) {
|
2017-07-19 15:12:10 +08:00
|
|
|
case FETCH_ADD_INTERFACE_INPUT:
|
2017-07-18 12:53:53 +08:00
|
|
|
return {
|
|
|
|
...state,
|
2017-07-19 15:12:10 +08:00
|
|
|
inputValue: action.payload
|
2017-07-18 12:53:53 +08:00
|
|
|
}
|
2017-07-19 15:12:10 +08:00
|
|
|
case FETCH_ADD_INTERFACE_TAG_VALUE:
|
2017-07-18 12:53:53 +08:00
|
|
|
return {
|
|
|
|
...state,
|
2017-07-19 15:12:10 +08:00
|
|
|
tagValue: action.payload
|
2017-07-18 12:53:53 +08:00
|
|
|
}
|
2017-07-19 15:12:10 +08:00
|
|
|
case FETCH_ADD_INTERFACE_HEADER_VALUE:
|
2017-07-18 12:53:53 +08:00
|
|
|
return {
|
|
|
|
...state,
|
2017-07-19 15:12:10 +08:00
|
|
|
headerValue: action.payload
|
|
|
|
}
|
|
|
|
case ADD_INTERFACE_SEQ_HEADER:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
seqGroup: action.payload
|
|
|
|
}
|
|
|
|
case DELETE_INTERFACE_SEQ_HEADER:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
seqGroup: action.payload
|
|
|
|
}
|
2017-07-20 14:48:29 +08:00
|
|
|
case GET_INTERFACE_REQ_PARAMS:
|
2017-07-19 15:12:10 +08:00
|
|
|
return {
|
|
|
|
...state,
|
2017-07-19 19:29:18 +08:00
|
|
|
reqParams: action.payload
|
|
|
|
}
|
2017-07-20 14:48:29 +08:00
|
|
|
case GET_INTERFACE_RES_PARAMS:
|
2017-07-19 19:29:18 +08:00
|
|
|
return {
|
|
|
|
...state,
|
2017-07-20 14:48:29 +08:00
|
|
|
resParams: action.payload
|
2017-07-19 19:29:18 +08:00
|
|
|
}
|
2017-07-20 14:48:29 +08:00
|
|
|
case SAVE_INTERFACE_FORMS:
|
2017-07-19 19:29:18 +08:00
|
|
|
return {
|
|
|
|
...state,
|
2017-07-20 14:48:29 +08:00
|
|
|
resParams: action.payload
|
2017-07-18 12:53:53 +08:00
|
|
|
}
|
2017-07-20 16:34:46 +08:00
|
|
|
case PUSH_INTERFACE_NAME:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
resParams: action.payload
|
|
|
|
}
|
2017-07-20 16:57:21 +08:00
|
|
|
case PUSH_INTERFACE_METHOD:
|
|
|
|
return {
|
|
|
|
...state,
|
2017-07-20 17:20:30 +08:00
|
|
|
method: action.payload
|
2017-07-20 16:57:21 +08:00
|
|
|
}
|
2017-07-18 12:53:53 +08:00
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
}
|