Dmitriy Pleshevskiy
49aac94675
chore: add dist folder to repo chore(deps): add node-fetch for tests chore: change prepare request visibility chore: add tests for prepare request method chore: update example Closes #20
13 lines
572 B
JavaScript
13 lines
572 B
JavaScript
export function requestReducer(state, action) {
|
|
switch (action.type) {
|
|
case 'call': {
|
|
return Object.assign(Object.assign({}, state), { loading: true, isCalled: true, prevHeaders: action.headers, prevVariables: action.variables, prevParams: action.params });
|
|
}
|
|
case 'success': {
|
|
return Object.assign(Object.assign({}, state), { loading: false, data: action.response.data });
|
|
}
|
|
case 'failure': {
|
|
return Object.assign(Object.assign({}, state), { loading: false, data: null });
|
|
}
|
|
}
|
|
}
|