post payback
This commit is contained in:
@@ -10,7 +10,7 @@ import { Transaction } from "./transaction";
|
||||
import { TokenUtil } from "../utils/token";
|
||||
import { Category } from "./category";
|
||||
import { Subcategory } from "./subcategory";
|
||||
|
||||
import { Payback } from "./payback";
|
||||
import { Role } from "./role";
|
||||
|
||||
export class Store {
|
||||
@@ -23,6 +23,7 @@ export class Store {
|
||||
supplier = new Supplier(this);
|
||||
commission = new Commission(this);
|
||||
category = new Category(this);
|
||||
payback = new Payback(this);
|
||||
transaction = new Transaction(this);
|
||||
subcategory = new Subcategory(this);
|
||||
role = new Role(this);
|
||||
|
||||
91
src/store/payback.js
Normal file
91
src/store/payback.js
Normal file
@@ -0,0 +1,91 @@
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import { http } from "../utils/http";
|
||||
|
||||
export class Payback {
|
||||
page = 0;
|
||||
pageSize = 10;
|
||||
data = [];
|
||||
total_data = 0;
|
||||
filterCategory = null;
|
||||
visibleModalPayback = false;
|
||||
|
||||
pageCategories = 0;
|
||||
pageSizeCategories = 10;
|
||||
dataCategories = [];
|
||||
total_dataCategories = 0;
|
||||
|
||||
pageSubCategories = 0;
|
||||
pageSizeSubCategories = 10;
|
||||
dataSubCategories = [];
|
||||
total_dataSubCategories = 0;
|
||||
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
async getData() {
|
||||
try {
|
||||
const response = await http.get(
|
||||
`/transaction/deposit-return?page=${this.page}&pageSize=${this.pageSize}`
|
||||
);
|
||||
//console.log(response)
|
||||
this.data =
|
||||
response.body[0].map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item;
|
||||
}) ?? [];
|
||||
|
||||
this.total_data = response.body.total_data ?? 0;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async getDataUser() {
|
||||
try {
|
||||
const response = await http.get(
|
||||
`/transaction/deposit-return/confirmation?page=${this.page}&pageSize=${this.pageSize}`
|
||||
);
|
||||
console.log(response);
|
||||
this.data =
|
||||
response.body[0].map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item;
|
||||
}) ?? [];
|
||||
|
||||
this.total_data = response.body.total_data ?? 0;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async update(id, data) {
|
||||
try {
|
||||
const response = await http.put(`/config/commission/${id}`).send(data);
|
||||
await this.getData();
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async delete(id) {
|
||||
try {
|
||||
const response = await http.del(`/product/${id}`);
|
||||
await this.getData();
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
async create(data) {
|
||||
try {
|
||||
console.log(data)
|
||||
return await http.post("/transaction/deposit-return").send(data);
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user