File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ const mapDispatchToProps = dispatch => ({
7
7
dispatch ( { type : 'SET_PAGE' , page, payload } )
8
8
} ) ;
9
9
10
+ const mapStateToProps = state => ( {
11
+ tag : state . articleList . tag
12
+ } )
13
+
10
14
const ListPagination = props => {
11
15
if ( props . articlesCount <= 10 ) {
12
16
return null ;
@@ -17,7 +21,13 @@ const ListPagination = props => {
17
21
range . push ( i ) ;
18
22
}
19
23
20
- const setPage = page => props . onSetPage ( page , agent . Articles . all ( page ) ) ;
24
+ const setPage = page => {
25
+ if ( props . tag ) {
26
+ props . onSetPage ( page , agent . Articles . byTag ( props . tag , page ) )
27
+ } else {
28
+ props . onSetPage ( page , agent . Articles . all ( page ) )
29
+ }
30
+ } ;
21
31
22
32
return (
23
33
< nav >
@@ -48,4 +58,4 @@ const ListPagination = props => {
48
58
) ;
49
59
} ;
50
60
51
- export default connect ( ( ) => ( { } ) , mapDispatchToProps ) ( ListPagination ) ;
61
+ export default connect ( mapStateToProps , mapDispatchToProps ) ( ListPagination ) ;
You can’t perform that action at this time.
0 commit comments