Advertisement
ronymmoura

Untitled

Aug 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Código antigo
  2. onClickPagination(page) {
  3.     console.log(this.state.totalPages)
  4.     service.ListPerPage(page, this.state.perPage)
  5.     .then((result) => {
  6.         this.setState({ itemsCurrentPage: result.data.Data })
  7.     })
  8.     .catch((err) => {
  9.         console.error(err);
  10.     })
  11. }
  12.  
  13. // Código novo
  14. async onClickPagination(page) {
  15.     try {
  16.         var result = await service.ListPerPage(page, this.state.perPage);
  17.         await this.setState({ itemsCurrentPage: result.data.Data });
  18.     } catch(err) {
  19.         console.error(err);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement