export const getItems= () => {
return async dispatch => {
await axios.get(baseUrl + '/items', {
params: {
token: someToken
}
})
.then(res => {
dispatch({type: 'GET_ITEM', data: res.data})
dispatch({ type: 'FETCH_SUCCESS' });
})
.catch(error => {
dispatch({ type: 'FETCH_FAILED', message: error });
});
}
}
import { combineReducers } from 'redux';
import someone from './someone';
import someoneT from './someoneT';
export const rootReducer = (state, action) => {
if (action.type === 'URL_CHANGED') {
state = {}
}
return appReducer(state, action)
}
const appReducer = combineReducers({
someone,
someoneT
})