@@ -3,19 +3,16 @@ import { persistReducer } from 'redux-persist'
33
44import {
55 SET_FEED_FILTER ,
6- SET_FEED_TAB ,
76 SetFeedFilterAction ,
8- SetFeedTabAction ,
97 FeedPageAction
108} from '~/store/pages/feed/actions'
119
12- import { FeedFilter , FeedTab } from '../../../models'
10+ import { FeedFilter } from '../../../models'
1311
1412import { FeedPageState } from './types'
1513
16- const initialState : FeedPageState = {
17- feedFilter : FeedFilter . ALL ,
18- feedTab : FeedTab . FOR_YOU
14+ const initialState = {
15+ feedFilter : FeedFilter . ALL
1916}
2017
2118const actionsMap = {
@@ -24,26 +21,19 @@ const actionsMap = {
2421 ...state ,
2522 feedFilter : action . filter
2623 }
27- } ,
28- [ SET_FEED_TAB ] ( state : FeedPageState , action : SetFeedTabAction ) {
29- return {
30- ...state ,
31- feedTab : action . tab
32- }
3324 }
3425}
3526
3627const feedPageReducer = ( state = initialState , action : FeedPageAction ) => {
37- const matchingReduceFunction =
38- actionsMap [ action . type as keyof typeof actionsMap ]
28+ const matchingReduceFunction = actionsMap [ action . type ]
3929 if ( ! matchingReduceFunction ) return state
40- return matchingReduceFunction ( state , action as any )
30+ return matchingReduceFunction ( state , action )
4131}
4232
4333export const feedPagePersistConfig = ( storage : Storage ) => ( {
4434 key : 'feed-page' ,
4535 storage,
46- whitelist : [ 'feedFilter' , 'feedTab' ]
36+ whitelist : [ 'feedFilter' ]
4737} )
4838
4939const persistedFeedPageReducer = ( storage : Storage ) => {
0 commit comments