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

@@ -23,10 +23,10 @@ export class Category {
try {
const response = await http.get(`/product/categories?page=${this.page}&pageSize=${this.pageSize}`);
this.data = response.body.data.map((item, idx) => {
item.key = idx;
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
item.key = idx;
return item
}) ?? []
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
}