Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Adapt tags reducers to support new recent tags API
Browse files Browse the repository at this point in the history
  • Loading branch information
artkravchenko committed Dec 16, 2017
1 parent 7d5a2d3 commit 0fca66b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/store/geotags.js
Expand Up @@ -49,14 +49,20 @@ export default function reducer(state = initialState, action) {
break;
}

case recentTags.SET_RECENT_TAGS:
case g.SET_GEOTAGS: {
const geotags = keyBy(action.payload.geotags, 'url_name');
state = fromJS(geotags);

break;
}

case recentTags.SET_RECENT_TAGS: {
const geotags = keyBy(action.payload.geotags.entries, 'url_name');
state = state.merge(fromJS(geotags));

break;
}

case g.CONTINENT_NAV__SET: {
const geotags = keyBy(concat(action.payload.continents, action.payload.countries), 'url_name');
state = state.merge(fromJS(geotags));
Expand Down
8 changes: 7 additions & 1 deletion src/store/hashtags.js
Expand Up @@ -33,14 +33,20 @@ export default function reducer(state = initialState, action) {
break;
}

case recentTags.SET_RECENT_TAGS:
case h.SET_HASHTAGS: {
const hashtags = keyBy(action.payload.hashtags, 'name');
state = state.merge(fromJS(hashtags));

break;
}

case recentTags.SET_RECENT_TAGS: {
const hashtags = keyBy(action.payload.hashtags.entries, 'name');
state = state.merge(fromJS(hashtags));

break;
}

case users.SET_CURRENT_USER: {
if (!action.payload.user) {
break;
Expand Down
8 changes: 7 additions & 1 deletion src/store/schools.js
Expand Up @@ -49,14 +49,20 @@ export default function reducer(state = initialState, action) {
break;
}

case recentTags.SET_RECENT_TAGS:
case s.SET_SCHOOLS: {
const schools = keyBy(action.payload.schools.map(school => cleanupSchoolObject(school)), 'id');
state = state.merge(fromJS(schools));

break;
}

case recentTags.SET_RECENT_TAGS: {
const schools = keyBy(action.payload.schools.entries.map(school => cleanupSchoolObject(school)), 'id');
state = state.merge(fromJS(schools));

break;
}

case users.SET_CURRENT_USER: {
if (!action.payload.user) {
break;
Expand Down

0 comments on commit 0fca66b

Please sign in to comment.