Updated redux gab_trends -> gab for our services

• Updated:
- redux gab_trends -> gab for our services
- TrendsPanel to use updated route
This commit is contained in:
mgabdev
2020-09-10 17:21:39 -05:00
parent 793f46253c
commit fb8c705ebf
4 changed files with 59 additions and 8 deletions

View File

@@ -1,8 +1,11 @@
import {
GAB_TRENDS_RESULTS_FETCH_REQUEST,
GAB_TRENDS_RESULTS_FETCH_SUCCESS,
GAB_TRENDS_RESULTS_FETCH_FAIL
} from '../actions/gab_trends'
GAB_TRENDS_RESULTS_FETCH_FAIL,
GAB_NEWS_RESULTS_FETCH_REQUEST,
GAB_NEWS_RESULTS_FETCH_SUCCESS,
GAB_NEWS_RESULTS_FETCH_FAIL,
} from '../actions/gab'
import {
Map as ImmutableMap,
List as ImmutableList,
@@ -20,6 +23,11 @@ const initialState = ImmutableMap({
isLoading: false,
isError: false,
}),
news: ImmutableMap({
items: {},
isLoading: false,
isError: false,
}),
})
const normalizeList = (state, type, items) => {
@@ -56,6 +64,12 @@ export default function (state = initialState, action) {
return state
case GAB_TRENDS_RESULTS_FETCH_FAIL:
return setListFailed(state, action.feedType)
case GAB_NEWS_RESULTS_FETCH_REQUEST:
return state.setIn(['news', 'isLoading'], true);
case GAB_NEWS_RESULTS_FETCH_SUCCESS:
return normalizeList(state, 'news', action.items)
case GAB_NEWS_RESULTS_FETCH_FAIL:
return setListFailed(state, 'news')
default:
return state
}

View File

@@ -7,7 +7,7 @@ import contexts from './contexts'
import conversations from './conversations'
import custom_emojis from './custom_emojis'
import filters from './filters'
import gab_trends from './gab_trends'
import gab from './gab'
import groups from './groups'
import group_categories from './group_categories'
import group_editor from './group_editor'
@@ -50,7 +50,7 @@ const reducers = {
conversations,
custom_emojis,
filters,
gab_trends,
gab,
groups,
group_categories,
group_editor,