Menu Supplier

This commit is contained in:
2021-12-15 18:30:27 +07:00
parent 08b82c55ab
commit 4df9f7214e
7 changed files with 287 additions and 261 deletions

View File

@@ -7,7 +7,7 @@ export class Subcategory {
data = [];
total_data = 0;
filterCategory = null;
visibleModalCategory = false;
visibleModalSubcategory = false;
pageCategories = 0;
pageSizeCategories = 10
@@ -38,24 +38,15 @@ export class Subcategory {
this.total_dataSubCategories = response.body.count ?? 0
}
async getDataCategories() {
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
if (this.dataCategories.length > 0) {
this.filterCategory = this.dataCategories[0].id
}
}
async create(data) {
const response = await http.post('/product/categories').send(data);
const response = await http.post('/product/sub-categories').send(data);
console.log(response)
await this.getData();
return response;
}
async update(id, data) {
const response = await http.put(`/product/categories/${id}`).send(data);
const response = await http.put(`/product/sub-categories/${id}`).send(data);
await this.getData();
return response;
}