feat: fix paging data
This commit is contained in:
parent
1bf45213de
commit
f2b754a187
|
@ -23,10 +23,10 @@ export class Category {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/product/categories?page=${this.page}&pageSize=${this.pageSize}`);
|
const response = await http.get(`/product/categories?page=${this.page}&pageSize=${this.pageSize}`);
|
||||||
this.data = response.body.data.map((item, idx) => {
|
this.data = response.body.data.map((item, idx) => {
|
||||||
item.key = idx;
|
item.key = idx;
|
||||||
return item
|
return item
|
||||||
}) ?? []
|
}) ?? []
|
||||||
this.total_data = response.body.total_data ?? 0
|
this.total_data = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ export class Category {
|
||||||
return item
|
return item
|
||||||
}) ?? []
|
}) ?? []
|
||||||
|
|
||||||
this.total_dataCategories = response.body.total_data ?? 0
|
this.total_dataCategories = response?.body?.count ?? 0
|
||||||
if (this.dataCategories.length > 0) {
|
if (this.dataCategories.length > 0) {
|
||||||
this.filterCategory = this.dataCategories[0].id
|
this.filterCategory = this.dataCategories[0].id
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ export class Commission {
|
||||||
return item
|
return item
|
||||||
}) ?? []
|
}) ?? []
|
||||||
|
|
||||||
this.total_data = response.body.total_data ?? 0
|
this.total_data = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class Membership {
|
||||||
return item
|
return item
|
||||||
}) ?? []
|
}) ?? []
|
||||||
|
|
||||||
this.total_data = response.body.total_data ?? 0
|
this.total_data = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ export class Membership {
|
||||||
return item
|
return item
|
||||||
}) ?? []
|
}) ?? []
|
||||||
|
|
||||||
this.total_data = response.body.total_data ?? 0
|
this.total_data = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { makeAutoObservable } from "mobx";
|
import {makeAutoObservable} from "mobx";
|
||||||
import { http } from "../utils/http";
|
import {http} from "../utils/http";
|
||||||
|
|
||||||
export class Payback {
|
export class Payback {
|
||||||
page = 0;
|
page = 0;
|
||||||
|
@ -36,7 +36,7 @@ export class Payback {
|
||||||
return item;
|
return item;
|
||||||
}) ?? [];
|
}) ?? [];
|
||||||
|
|
||||||
this.total_data = response.body.total_data ?? 0;
|
this.total_data = response?.body?.count ?? 0;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export class Payback {
|
||||||
return item;
|
return item;
|
||||||
}) ?? [];
|
}) ?? [];
|
||||||
|
|
||||||
this.total_data = response.body.total_data ?? 0;
|
this.total_data = response?.body?.count ?? 0;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ export class Product {
|
||||||
return item
|
return item
|
||||||
}) ?? []
|
}) ?? []
|
||||||
|
|
||||||
this.total_data = response.body.total_data ?? 0
|
this.total_data = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { makeAutoObservable } from "mobx";
|
import {makeAutoObservable} from "mobx";
|
||||||
import { http } from "../utils/http";
|
import {http} from "../utils/http";
|
||||||
|
|
||||||
export class Role {
|
export class Role {
|
||||||
page = null;
|
page = null;
|
||||||
|
@ -20,7 +20,7 @@ export class Role {
|
||||||
}&pageSize=${this.pageSize}`
|
}&pageSize=${this.pageSize}`
|
||||||
);
|
);
|
||||||
this.data = response.body.data ?? [];
|
this.data = response.body.data ?? [];
|
||||||
this.total_data = response.body.total_data ?? 0;
|
this.total_data = response?.body?.count ?? 0;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class Subcategory {
|
||||||
return item
|
return item
|
||||||
}) ?? []
|
}) ?? []
|
||||||
|
|
||||||
this.total_data = response.body.total_data ?? 0
|
this.total_data = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ export class Transaction {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/product/by-categories-all?sub-category=${this.filterSubCategory}&page=${this.page}&pageSize=${this.pageSize}`);
|
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.data = response.body.data ?? []
|
||||||
this.total_data = response.body.total_data ?? 0
|
this.total_data = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ export class Transaction {
|
||||||
const response = await http.get(`/product/categories?page=${this.pageCategories}&pageSize=${this.pageSizeCategories}`);
|
const response = await http.get(`/product/categories?page=${this.pageCategories}&pageSize=${this.pageSizeCategories}`);
|
||||||
|
|
||||||
this.dataCategories = response.body.data ?? []
|
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) {
|
if (this.dataCategories.length > 0) {
|
||||||
this.filterCategory = this.dataCategories[0].id
|
this.filterCategory = this.dataCategories[0].id
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ export class Transaction {
|
||||||
const response = await http.get(`/transaction/history?page=${this.pageHistoryTransaction}`);
|
const response = await http.get(`/transaction/history?page=${this.pageHistoryTransaction}`);
|
||||||
|
|
||||||
this.dataHistoryTransaction = response.body.data ?? []
|
this.dataHistoryTransaction = response.body.data ?? []
|
||||||
this.total_dataHistoryTransaction = response.body.total_data ?? 0
|
this.total_dataHistoryTransaction = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user