- fix pagination between history transaction, etc

This commit is contained in:
Muhammad Fadli 2023-05-04 02:11:20 +07:00
parent e1ce45848a
commit 566a8d089c
3 changed files with 20 additions and 16 deletions

View File

@ -829,8 +829,8 @@ export const DetailUser = observer(() => {
}}
onChange={async (page) => {
let pageNumber = page.current;
store.transaction.pageSize = page.pageSize;
store.transaction.page = pageNumber - 1;
store.transaction.pageSizeHistoryTopUp = page.pageSize;
store.transaction.pageHistoryTopUp = pageNumber - 1;
modalLoader.setLoading(true);
await getData();
modalLoader.setLoading(false);

View File

@ -601,16 +601,16 @@ export const Profile = observer(() => {
dataSource={store.transaction.dataHistoryTopUpProfile}
bordered
pagination={{
pageSize: store.transaction.pageSize,
pageSize: store.transaction.pageSizeHistoryTopUpProfile,
total: store.transaction.total_dataHistoryTopUpProfile,
current: store.transaction.page + 1,
current: store.transaction.pageHistoryTopUpProfile + 1,
showSizeChanger: true,
simple: false,
}}
onChange={async (page) => {
let pageNumber = page.current;
store.transaction.pageSize = page.pageSize;
store.transaction.page = pageNumber - 1;
store.transaction.pageSizeHistoryTopUpProfile = page.pageSize;
store.transaction.pageHistoryTopUpProfile = pageNumber - 1;
modalLoader.setLoading(true);
await store.transaction.getDataHistoryTopUpProfile(
store.authentication.profileData?.id
@ -854,16 +854,16 @@ export const Profile = observer(() => {
dataSource={store.transaction.dataHistorybillProfile}
bordered
pagination={{
pageSize: store.transaction.pageSize,
pageSize: store.transaction.pageSizeHistorybillProfile,
total: store.transaction.total_dataHistorybillProfile,
current: store.transaction.page + 1,
current: store.transaction.pageHistorybillProfile + 1,
showSizeChanger: true,
simple: false,
}}
onChange={async (page) => {
let pageNumber = page.current;
store.transaction.pageSize = page.pageSize;
store.transaction.page = pageNumber - 1;
store.transaction.pageSizeHistorybillProfile = page.pageSize;
store.transaction.pageHistorybillProfile = pageNumber - 1;
modalLoader.setLoading(true);
await store.transaction.getDataHistoryCheckBill();
modalLoader.setLoading(false);

View File

@ -46,9 +46,13 @@ export class Transaction {
dataHistoryTopUp = [];
total_dataHistoryTopUp = 0;
pageHistorybillProfile = 0;
pageSizeHistorybillProfile = 10;
dataHistorybillProfile = [];
total_dataHistorybillProfile = 0;
pageHistoryTopUpProfile = 0;
pageSizeHistoryTopUpProfile = 10;
dataHistoryTopUpProfile = [];
total_dataHistoryTopUpProfile = 0;
@ -141,12 +145,12 @@ export class Transaction {
async getDataHistoryCheckBill() {
try {
const response = await http.get(
`/transaction/check-bill-history`
);
// const response = await http.get(
// `/transaction/check-bill-history?page=${this.page}&pageSize=${this.pageSize}&start=${this.filterStart}&end=${this.filterEnd}`
// `/transaction/check-bill-history`
// );
const response = await http.get(
`/transaction/check-bill-history?page=${this.pageHistorybillProfile}&pageSize=${this.pageSizeHistorybillProfile}`
);
console.log("bill", response);
this.dataHistorybillProfile = response.body.data ?? [];
this.total_dataHistorybillProfile = response?.body?.count ?? 0;
@ -183,7 +187,7 @@ export class Transaction {
async getDataHistoryTopUp(id) {
try {
const response = await http.get(
`/transaction/history-deposit?page=${this.page}&pageSize=${this.pageSize}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}`
`/transaction/history-deposit?page=${this.pageHistoryTopUp}&pageSize=${this.pageSizeHistoryTopUp}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}`
);
console.log(response, 'get data history')
this.dataHistoryTopUp = response.body.data ?? [];
@ -196,7 +200,7 @@ export class Transaction {
async getDataHistoryTopUpProfile(id) {
try {
const response = await http.get(
`/transaction/history-deposit-profile?page=${this.page}&pageSize=${this.pageSize}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}`
`/transaction/history-deposit-profile?page=${this.pageHistoryTopUpProfile}&pageSize=${this.pageSizeHistoryTopUpProfile}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}`
);
console.log(response, 'get data history Profile')
this.dataHistoryTopUpProfile = response.body.data ?? [];