Skip to content

Commit 0035dd6

Browse files
committed
Fixed float page number in request
1 parent 13c4499 commit 0035dd6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/reducer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,20 @@ export default function reducer(state = {}, action) {
108108
[actions.SET_LIMIT]: () => {
109109
let maxPage = 1;
110110
if (payload.limit > 0) {
111-
maxPage = (tableState.query.count / payload.limit) || 1
111+
maxPage = Math.floor((tableState.query.count / payload.limit)) || 1;
112112
}
113113
const currentPage = tableState.query.page > maxPage ? maxPage : tableState.query.page;
114114
const offset = (currentPage - 1) * payload.limit;
115115

116116
let page = 1;
117117
if (payload.limit > 0) {
118-
page = (offset / payload.limit) + 1;
118+
page = Math.floor((offset / payload.limit) + 1);
119119
}
120120
return stateUpdater({
121121
isFetching: true,
122122
query: {
123123
limit: parseInt(payload.limit, 10),
124-
page,
124+
page: page <= 1 ? 1 : page,
125125
offset
126126
},
127127
})

0 commit comments

Comments
 (0)