diff --git a/client/coral-framework/actions/assets.js b/client/coral-framework/actions/assets.js index 5de9a86d5..e5073b63c 100644 --- a/client/coral-framework/actions/assets.js +++ b/client/coral-framework/actions/assets.js @@ -1,19 +1,19 @@ import coralApi from '../helpers/response'; import {addItem} from './items'; -export const FETCH_MULTIPLE_ASSETS = 'FETCH_MULTIPLE_ASSETS'; -export const RECEIVE_MULTIPLE_ASSETS = 'RECEIVE_MULTIPLE_ASSETS'; -export const FAILURE_MULTIPLE_ASSSETS = 'FAILURE_MULTIPLE_ASSSETS'; +export const MULTIPLE_ASSETS_REQUEST = 'MULTIPLE_ASSETS_REQUEST'; +export const MULTIPLE_ASSETS_SUCCESS = 'MULTIPLE_ASSETS_SUCCESS'; +export const MULTIPLE_ASSSETS_FAILURE = 'MULTIPLE_ASSSETS_FAILURE'; export const fetchMulitpleAssets = ids => { return dispatch => { - dispatch({type: FETCH_MULTIPLE_ASSETS}); + dispatch({type: MULTIPLE_ASSETS_REQUEST}); coralApi(`/assets/multi?ids=${encodeURIComponent(ids.join(','))}`) .then(assets => { assets.forEach(asset => dispatch(addItem(asset, 'assets'))); - dispatch({type: RECEIVE_MULTIPLE_ASSETS, assets: assets.map(asset => asset.id)}); + dispatch({type: MULTIPLE_ASSETS_SUCCESS, assets: assets.map(asset => asset.id)}); }) - .catch(error => dispatch({type: FAILURE_MULTIPLE_ASSSETS, error})); + .catch(error => dispatch({type: MULTIPLE_ASSSETS_FAILURE, error})); }; }; diff --git a/client/coral-framework/actions/user.js b/client/coral-framework/actions/user.js index e1d12b3e3..b279ad0a4 100644 --- a/client/coral-framework/actions/user.js +++ b/client/coral-framework/actions/user.js @@ -30,19 +30,19 @@ export const saveBio = (user_id, formData) => dispatch => { */ export const fetchCommentsByUserId = userId => { return (dispatch) => { - dispatch({type: actions.REQUEST_COMMENTS_BY_USER}); + dispatch({type: actions.COMMENTS_BY_USER_REQUEST}); return coralApi(`/comments?user_id${userId}`) .then(({comments}) => { comments.forEach(comment => { dispatch(addItem(comment, 'comments')); }); - dispatch({type: actions.RECEIVE_COMMENTS_BY_USER, comments: comments.map(comment => comment.id)}); + dispatch({type: actions.COMMENTS_BY_USER_SUCCESS, comments: comments.map(comment => comment.id)}); }) .catch(error => { console.error(error.stack); console.error('FAILURE_COMMENTS_BY_USER', error); - dispatch({type: actions.FAILURE_COMMENTS_BY_USER, error}); + dispatch({type: actions.COMMENTS_BY_USER_FAILURE, error}); }); }; }; diff --git a/client/coral-framework/constants/user.js b/client/coral-framework/constants/user.js index ce9af61a2..6e09726d3 100644 --- a/client/coral-framework/constants/user.js +++ b/client/coral-framework/constants/user.js @@ -1,6 +1,6 @@ export const SAVE_BIO_REQUEST = 'SAVE_BIO_REQUEST'; export const SAVE_BIO_SUCCESS = 'SAVE_BIO_SUCCESS'; export const SAVE_BIO_FAILURE = 'SAVE_BIO_FAILURE'; -export const REQUEST_COMMENTS_BY_USER = 'REQUEST_COMMENTS_BY_USER'; -export const RECEIVE_COMMENTS_BY_USER = 'RECEIVE_COMMENTS_BY_USER'; -export const FAILURE_COMMENTS_BY_USER = 'FAILURE_COMMENTS_BY_USER'; +export const COMMENTS_BY_USER_REQUEST = 'COMMENTS_BY_USER_REQUEST'; +export const COMMENTS_BY_USER_SUCCESS = 'COMMENTS_BY_USER_SUCCESS'; +export const COMMENTS_BY_USER_FAILURE = 'COMMENTS_BY_USER_FAILURE'; diff --git a/client/coral-framework/reducers/user.js b/client/coral-framework/reducers/user.js index c4d061b42..5c064e07a 100644 --- a/client/coral-framework/reducers/user.js +++ b/client/coral-framework/reducers/user.js @@ -33,9 +33,9 @@ export default function user (state = initialState, action) { case actions.SAVE_BIO_SUCCESS: return state .set('settings', action.settings); - case actions.RECEIVE_COMMENTS_BY_USER: + case actions.COMMENTS_BY_USER_SUCCESS: return state.set('myComments', fromJS(action.comments)); - case assetActions.RECEIVE_MULTIPLE_ASSETS: + case assetActions.MULTIPLE_ASSETS_SUCCESS: return state.set('myAssets', fromJS(action.assets)); default : return state;