feat: fix paging data

This commit is contained in:
caturbgs 2021-12-20 13:59:24 +07:00
parent 1bf45213de
commit f2b754a187
8 changed files with 20 additions and 20 deletions

View File

@ -26,7 +26,7 @@ export class Category {
item.key = idx;
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.log(e);
}
@ -55,7 +55,7 @@ export class Category {
return item
}) ?? []
this.total_dataCategories = response.body.total_data ?? 0
this.total_dataCategories = response?.body?.count ?? 0
if (this.dataCategories.length > 0) {
this.filterCategory = this.dataCategories[0].id
}

View File

@ -32,7 +32,7 @@ export class Commission {
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}

View File

@ -23,7 +23,7 @@ export class Membership {
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}
@ -40,7 +40,7 @@ export class Membership {
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}

View File

@ -1,5 +1,5 @@
import { makeAutoObservable } from "mobx";
import { http } from "../utils/http";
import {makeAutoObservable} from "mobx";
import {http} from "../utils/http";
export class Payback {
page = 0;
@ -36,7 +36,7 @@ export class Payback {
return item;
}) ?? [];
this.total_data = response.body.total_data ?? 0;
this.total_data = response?.body?.count ?? 0;
} catch (e) {
console.error(e);
}
@ -54,7 +54,7 @@ export class Payback {
return item;
}) ?? [];
this.total_data = response.body.total_data ?? 0;
this.total_data = response?.body?.count ?? 0;
} catch (e) {
console.error(e);
}

View File

@ -36,7 +36,7 @@ export class Product {
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}

View File

@ -1,5 +1,5 @@
import { makeAutoObservable } from "mobx";
import { http } from "../utils/http";
import {makeAutoObservable} from "mobx";
import {http} from "../utils/http";
export class Role {
page = null;
@ -20,7 +20,7 @@ export class Role {
}&pageSize=${this.pageSize}`
);
this.data = response.body.data ?? [];
this.total_data = response.body.total_data ?? 0;
this.total_data = response?.body?.count ?? 0;
} catch (e) {
console.error(e);
}

View File

@ -33,7 +33,7 @@ export class Subcategory {
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}

View File

@ -35,7 +35,7 @@ export class Transaction {
try {
const response = await http.get(`/product/by-categories-all?sub-category=${this.filterSubCategory}&page=${this.page}&pageSize=${this.pageSize}`);
this.data = response.body.data ?? []
this.total_data = response.body.total_data ?? 0
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}
@ -56,7 +56,7 @@ export class Transaction {
const response = await http.get(`/product/categories?page=${this.pageCategories}&pageSize=${this.pageSizeCategories}`);
this.dataCategories = response.body.data ?? []
this.total_dataCategories = response.body.total_data ?? 0
this.total_dataCategories = response?.body?.count ?? 0
if (this.dataCategories.length > 0) {
this.filterCategory = this.dataCategories[0].id
}
@ -70,7 +70,7 @@ export class Transaction {
const response = await http.get(`/transaction/history?page=${this.pageHistoryTransaction}`);
this.dataHistoryTransaction = response.body.data ?? []
this.total_dataHistoryTransaction = response.body.total_data ?? 0
this.total_dataHistoryTransaction = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}