Commit 79f6e08c authored by Regis's avatar Regis

use switch for pagination

parent 6bf0bd0f
......@@ -66,18 +66,24 @@
const text = e.target.innerText;
const { totalPages, nextPage, previousPage } = this.pageInfo;
if (text === SPREAD) {
return;
} else if (text === LAST) {
switch (text) {
case SPREAD:
break;
case LAST:
pageNum = totalPages;
} else if (text === NEXT) {
break;
case NEXT:
pageNum = nextPage;
} else if (text === PREV) {
break;
case PREV:
pageNum = previousPage;
} else if (text === FIRST) {
break;
case FIRST:
pageNum = 1;
} else {
break;
default:
pageNum = +text;
break;
}
this.change(pageNum, apiScope);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment