mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-12 12:54:48 +08:00
31 lines
591 B
JavaScript
31 lines
591 B
JavaScript
|
import axios from 'axios'
|
||
|
|
||
|
// Actions
|
||
|
const FETCH_MOCK_COL = 'yapi/mockCol/FETCH_MOCK_COL';
|
||
|
|
||
|
// Reducer
|
||
|
const initialState = {
|
||
|
list: []
|
||
|
}
|
||
|
|
||
|
export default (state = initialState, action) => {
|
||
|
switch (action.type) {
|
||
|
case FETCH_MOCK_COL:
|
||
|
return {
|
||
|
...state,
|
||
|
list: action.payload.data.data
|
||
|
}
|
||
|
default:
|
||
|
return state
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Action Creators
|
||
|
export async function fetchMockCol(interfaceId) {
|
||
|
let result = await axios.get('/api/plugin/advmock/case/list?interface_id=' + interfaceId);
|
||
|
return {
|
||
|
type: FETCH_MOCK_COL,
|
||
|
payload: result.data
|
||
|
}
|
||
|
}
|