- Cleanup
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { List } from 'immutable';
|
||||
|
||||
import { fetchItems } from '../api/items.js';
|
||||
import { fetchItems as fetchItemsApi } from '../api/items.js';
|
||||
import {
|
||||
GET_ITEMS,
|
||||
ITEMS_LOADED,
|
||||
} from '../constants/actionTypes.js';
|
||||
import { getActiveEventId } from '../selectors/activeEvent.js';
|
||||
import { getLoginToken } from '../selectors/profile.js';
|
||||
import { getAuthToken } from '../selectors/auth.js';
|
||||
|
||||
import { blockUI, unblockUI } from './index.js';
|
||||
|
||||
@@ -24,16 +24,16 @@ const itemsFetchSuccess = (items) => (dispatch) => {
|
||||
};
|
||||
|
||||
const itemsFetchFailure = (error) => (dispatch) => {
|
||||
console.error('[actions::getItems]', error));
|
||||
console.error('[actions::items::itemsFetchFailure]', error);
|
||||
dispatch(itemsLoadFailure(error));
|
||||
dispatch(unblockUI);
|
||||
};
|
||||
|
||||
export const fetchItems = () => (dispatch, getState) => {
|
||||
const eventId = getActiveEventId(getState());
|
||||
const authToken = getLoginToken(getState());
|
||||
const authToken = getAuthToken(getState());
|
||||
|
||||
fetchItems(activeEvent, authToken)
|
||||
fetchItemsApi(activeEvent, authToken)
|
||||
.then(payload => dispatch(itemsFetchSuccess(payload)))
|
||||
.catch(err => dispatch(itemsFetchFailure(err));
|
||||
.catch(err => dispatch(itemsFetchFailure(err)));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user