- 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) => { onChange={async (page) => {
let pageNumber = page.current; let pageNumber = page.current;
store.transaction.pageSize = page.pageSize; store.transaction.pageSizeHistoryTopUp = page.pageSize;
store.transaction.page = pageNumber - 1; store.transaction.pageHistoryTopUp = pageNumber - 1;
modalLoader.setLoading(true); modalLoader.setLoading(true);
await getData(); await getData();
modalLoader.setLoading(false); modalLoader.setLoading(false);

View File

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

View File

@ -46,9 +46,13 @@ export class Transaction {
dataHistoryTopUp = []; dataHistoryTopUp = [];
total_dataHistoryTopUp = 0; total_dataHistoryTopUp = 0;
pageHistorybillProfile = 0;
pageSizeHistorybillProfile = 10;
dataHistorybillProfile = []; dataHistorybillProfile = [];
total_dataHistorybillProfile = 0; total_dataHistorybillProfile = 0;
pageHistoryTopUpProfile = 0;
pageSizeHistoryTopUpProfile = 10;
dataHistoryTopUpProfile = []; dataHistoryTopUpProfile = [];
total_dataHistoryTopUpProfile = 0; total_dataHistoryTopUpProfile = 0;
@ -141,12 +145,12 @@ export class Transaction {
async getDataHistoryCheckBill() { async getDataHistoryCheckBill() {
try { try {
const response = await http.get(
`/transaction/check-bill-history`
);
// const response = await http.get( // 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); console.log("bill", response);
this.dataHistorybillProfile = response.body.data ?? []; this.dataHistorybillProfile = response.body.data ?? [];
this.total_dataHistorybillProfile = response?.body?.count ?? 0; this.total_dataHistorybillProfile = response?.body?.count ?? 0;
@ -183,7 +187,7 @@ export class Transaction {
async getDataHistoryTopUp(id) { async getDataHistoryTopUp(id) {
try { try {
const response = await http.get( 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') console.log(response, 'get data history')
this.dataHistoryTopUp = response.body.data ?? []; this.dataHistoryTopUp = response.body.data ?? [];
@ -196,7 +200,7 @@ export class Transaction {
async getDataHistoryTopUpProfile(id) { async getDataHistoryTopUpProfile(id) {
try { try {
const response = await http.get( 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') console.log(response, 'get data history Profile')
this.dataHistoryTopUpProfile = response.body.data ?? []; this.dataHistoryTopUpProfile = response.body.data ?? [];