Bug Fixing Pagination
This commit is contained in:
		| @@ -5,7 +5,7 @@ export class Membership { | ||||
|     page = 0; | ||||
|     pageSize = 10 | ||||
|     data = []; | ||||
|     totalData = 0; | ||||
|     total_data = 0; | ||||
|  | ||||
|     dataDetail = {}; | ||||
|     dataMember=[]; | ||||
| @@ -25,17 +25,19 @@ export class Membership { | ||||
|             const response = await http.get(`/users?page=${this.page}&pageSize=${this.pageSize}&superior=${this.filterMembership}&type=${this.filterPartner}`); | ||||
|              console.log(this.filterMembership) | ||||
|             // console.log(this.filterPartner) | ||||
|              console.log(response) | ||||
|             this.dataMember = response.body.data.map((item, idx) => { | ||||
|                 item.key = idx; | ||||
|                 item.name = item?.user_detail?.name; | ||||
|                 item.phone_number = item?.user_detail?.phone_number; | ||||
|                 item.roleId = item?.roles.id; | ||||
|                 item.roleName = item?.roles.name; | ||||
|                 return item | ||||
|             }) ?? [] | ||||
|              //console.log(response) | ||||
|              this.dataMember = response.body.data ?? [] | ||||
|             // this.dataMember = response.body.data.map((item, idx) => { | ||||
|             //     item.key = idx; | ||||
|             //     item.name = item?.user_detail?.name; | ||||
|             //     item.phone_number = item?.user_detail?.phone_number; | ||||
|             //     item.roleId = item?.roles.id; | ||||
|             //     item.roleName = item?.roles.name; | ||||
|             //     return item | ||||
|             // }) ?? [] | ||||
|  | ||||
|             this.totalData = response?.body?.count ?? 0 | ||||
|             this.total_data = response?.body?.count ?? 0 | ||||
|             //console.log(this.total_data) | ||||
|         } catch (e) { | ||||
|             console.error(e); | ||||
|         } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import {makeAutoObservable} from "mobx"; | ||||
| import {http} from "../utils/http"; | ||||
| import { makeAutoObservable } from "mobx"; | ||||
| import { http } from "../utils/http"; | ||||
|  | ||||
| export class Payback { | ||||
|   pageCreated = 0; | ||||
| @@ -15,14 +15,14 @@ export class Payback { | ||||
|   totalDataConfirmation = 0; | ||||
|   //data=[] | ||||
|  | ||||
|     //filter | ||||
|     visibleModalFilterPayback = false; | ||||
|     filterMembership=null; | ||||
|     filterStart=null; | ||||
|     filterEnd=null; | ||||
|   //filter | ||||
|   visibleModalFilterPayback = false; | ||||
|   filterMembership = null; | ||||
|   filterStart = null; | ||||
|   filterEnd = null; | ||||
|  | ||||
|     //filter created | ||||
|     visibleModalFilterCreate=false | ||||
|   //filter created | ||||
|   visibleModalFilterCreate = false; | ||||
|   constructor(ctx) { | ||||
|     this.ctx = ctx; | ||||
|     makeAutoObservable(this); | ||||
| @@ -30,12 +30,14 @@ export class Payback { | ||||
|  | ||||
|   async getDataCreated() { | ||||
|     try { | ||||
|       const response = await http.get(`/transaction/deposit-return?page=${this.pageCreated}&pageSize=${this.pageSizeCreated}` | ||||
|       const response = await http.get( | ||||
|         `/transaction/deposit-return?page=${this.pageCreated}&pageSize=${this.pageSizeCreated}&start=${this.filterStart}&end=${this.filterEnd}` | ||||
|       ); | ||||
|       this.dataCreated = response.body.data.map((item, idx) => { | ||||
|         item.key = idx; | ||||
|         return item; | ||||
|       }) ?? []; | ||||
|       this.dataCreated = | ||||
|         response.body.data.map((item, idx) => { | ||||
|           item.key = idx; | ||||
|           return item; | ||||
|         }) ?? []; | ||||
|  | ||||
|       this.totalDataCreated = response.body.count ?? 0; | ||||
|     } catch (e) { | ||||
| @@ -46,13 +48,14 @@ export class Payback { | ||||
|   async getDataConfirmation() { | ||||
|     try { | ||||
|       const response = await http.get( | ||||
|           `/transaction/deposit-return/confirmation?page=${this.pageConfirmation}&pageSize=${this.pageSizeConfirmation}` | ||||
|         `/transaction/deposit-return/confirmation?page=${this.pageConfirmation}&pageSize=${this.pageSizeConfirmation}` | ||||
|       ); | ||||
|       console.log(response) | ||||
|       this.dataConfirmation = response.body.data.map((item, idx) => { | ||||
|         item.key = idx; | ||||
|         return item; | ||||
|       }) ?? []; | ||||
|       console.log(response); | ||||
|       this.dataConfirmation = | ||||
|         response.body.data.map((item, idx) => { | ||||
|           item.key = idx; | ||||
|           return item; | ||||
|         }) ?? []; | ||||
|  | ||||
|       this.totalDataConfirmation = response.body.count ?? 0; | ||||
|     } catch (e) { | ||||
| @@ -82,7 +85,9 @@ export class Payback { | ||||
|  | ||||
|   async create(data) { | ||||
|     try { | ||||
|       const response = await http.post("/transaction/deposit-return").send(data); | ||||
|       const response = await http | ||||
|         .post("/transaction/deposit-return") | ||||
|         .send(data); | ||||
|       await this.getDataCreated(); | ||||
|       return response; | ||||
|     } catch (e) { | ||||
| @@ -92,13 +97,12 @@ export class Payback { | ||||
|  | ||||
|   async confirmPayback(id, data) { | ||||
|     try { | ||||
|       const response = await http.put(`/transaction/deposit-return/confirmation/${id}/${data}`); | ||||
|       const response = await http.put( | ||||
|         `/transaction/deposit-return/confirmation/${id}/${data}` | ||||
|       ); | ||||
|       // console.log(response) | ||||
|       // this.data=response.body.data | ||||
|       await Promise.all([ | ||||
|         this.getDataConfirmation(), | ||||
|         this.getDataCreated() | ||||
|       ]) | ||||
|       await Promise.all([this.getDataConfirmation(), this.getDataCreated()]); | ||||
|       return response; | ||||
|     } catch (e) { | ||||
|       console.error(e); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user