- Cleanup

This commit is contained in:
2019-08-06 01:36:08 -04:00
parent 6e71ac688a
commit b8ddc54b99
43 changed files with 361 additions and 170 deletions

View File

@@ -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)));
};