Added trending_hashtags to redux to fetch on isXS in SearchLayout

• Added:
- trending_hashtags to redux to fetch on isXS in SearchLayout

• Removed:
- trending_hashtags from initial state
This commit is contained in:
mgabdev
2021-01-15 15:36:14 -05:00
parent f7b061845e
commit 2cd09a8e72
5 changed files with 134 additions and 29 deletions

View File

@@ -52,6 +52,7 @@ import suggestions from './suggestions'
import timelines from './timelines'
import timeline_injections from './timeline_injections'
import toasts from './toasts'
import trending_hashtags from './trending_hashtags'
import user from './user'
import user_lists from './user_lists'
@@ -109,6 +110,7 @@ const reducers = {
timelines,
timeline_injections,
toasts,
trending_hashtags,
user,
user_lists,
}

View File

@@ -0,0 +1,22 @@
import { Map as ImmutableMap } from 'immutable'
import {
TRENDING_HASHTAGS_FETCH_REQUEST,
TRENDING_HASHTAGS_FETCH_SUCCESS,
TRENDING_HASHTAGS_FETCH_FAIL,
} from '../actions/trending_hashtags'
const initialState = ImmutableMap({
fetched: false,
items: []
})
export default function trending_hashtags(state = initialState, action) {
switch (action.type) {
case TRENDING_HASHTAGS_FETCH_FAIL:
return state.set('fetched', true).set('items', [])
case TRENDING_HASHTAGS_FETCH_SUCCESS:
return state.set('fetched', true).set('items', action.hashtags)
default:
return state
}
}