feat: fixing data table produk and pagination in role admin table

This commit is contained in:
2022-04-13 11:41:32 +07:00
parent 972ea146d3
commit 7c949403e2
3 changed files with 41 additions and 29 deletions

View File

@@ -1,12 +1,12 @@
import {makeAutoObservable} from "mobx";
import {http} from "../utils/http";
import { makeAutoObservable } from "mobx";
import { http } from "../utils/http";
export class Product {
page = 0;
pageSize = 10
data = [];
total_data = 0;
total_data_partner=0;
total_data_partner = 0;
filterSupplier = null;
filterSubCategory = null;
visibleModalProduct = false;
@@ -28,10 +28,11 @@ export class Product {
totalDataPriceHistory = 0;
pagePriceHistory = 0;
pageProductPartner = 0;
pageSizeProductPartner = 10
pageSizePriceHistory = 10
dataDetailProduct = {};
dataProductPartner=[]
dataProductPartner = []
constructor(ctx) {
this.ctx = ctx;
@@ -54,6 +55,7 @@ export class Product {
}
}
async getDataSubCategories() {
try {
const response = await http.get(`/product/sub-categories?category=${this.filterCategory}&page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
@@ -100,10 +102,10 @@ export class Product {
async getProductPartner(id) {
try {
const response = await http.get(`/product/by-categories?page=${this.pageProductPartner}&pageSize=10&sub-category=${id}`);
const response = await http.get(`/product/by-categories?page=${this.pageProductPartner}&pageSize=${this.pageSizeProductPartner}&sub-category=${id}`);
console.log(response)
this.dataProductPartner = response.body.data
this.total_data_partner= response?.body?.count ?? 0
this.total_data_partner = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}