fix: payback menu swap API
This commit is contained in:
@@ -2,50 +2,50 @@ import {makeAutoObservable} from "mobx";
|
||||
import {http} from "../utils/http";
|
||||
|
||||
export class Payback {
|
||||
page = 0;
|
||||
pageSize = 10;
|
||||
data = [];
|
||||
total_data = 0;
|
||||
pageCreated = 0;
|
||||
pageSizeCreated = 10;
|
||||
dataCreated = [];
|
||||
totalDataCreated = 0;
|
||||
filterCategory = null;
|
||||
visibleModalPayback = false;
|
||||
|
||||
pagePaybackUser = 0;
|
||||
pageSizePaybackUser = 10;
|
||||
dataPaybackUser = [];
|
||||
total_dataPaybackUser = 0;
|
||||
pageConfirmation = 0;
|
||||
pageSizeConfirmation = 10;
|
||||
dataConfirmation = [];
|
||||
totalDataConfirmation = 0;
|
||||
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
async getData() {
|
||||
async getDataCreated() {
|
||||
try {
|
||||
const response = await http.get(
|
||||
`/transaction/deposit-return?page=${this.page}&pageSize=${this.pageSize}`
|
||||
`/transaction/deposit-return?page=${this.pageCreated}&pageSize=${this.pageSizeCreated}`
|
||||
);
|
||||
this.data = response.body.data.map((item, idx) => {
|
||||
this.dataCreated = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item;
|
||||
}) ?? [];
|
||||
|
||||
this.total_data = response.body.count ?? 0;
|
||||
this.totalDataCreated = response.body.count ?? 0;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async getDataUser() {
|
||||
async getDataConfirmation() {
|
||||
try {
|
||||
const response = await http.get(
|
||||
`/transaction/deposit-return/confirmation?page=${this.pagePaybackUser}&pageSize=${this.pageSizePaybackUser}`
|
||||
`/transaction/deposit-return/confirmation?page=${this.pageConfirmation}&pageSize=${this.pageSizeConfirmation}`
|
||||
);
|
||||
this.dataPaybackUser = response.body.data.map((item, idx) => {
|
||||
this.dataConfirmation = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item;
|
||||
}) ?? [];
|
||||
|
||||
this.total_dataPaybackUser = response.body.count ?? 0;
|
||||
this.totalDataConfirmation = response.body.count ?? 0;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export class Payback {
|
||||
async update(id, data) {
|
||||
try {
|
||||
const response = await http.put(`/config/commission/${id}`).send(data);
|
||||
await this.getData();
|
||||
await this.getDataCreated();
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -64,7 +64,7 @@ export class Payback {
|
||||
async delete(id) {
|
||||
try {
|
||||
const response = await http.del(`/product/${id}`);
|
||||
await this.getData();
|
||||
await this.getDataCreated();
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -74,7 +74,7 @@ export class Payback {
|
||||
async create(data) {
|
||||
try {
|
||||
const response = await http.post("/transaction/deposit-return").send(data);
|
||||
await this.getData();
|
||||
await this.getDataCreated();
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
||||
Reference in New Issue
Block a user