feat: crud product

This commit is contained in:
caturbgs
2021-12-10 13:52:49 +07:00
parent 91ade48bea
commit 412ecc827e
3 changed files with 26 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
import {action, makeAutoObservable} from "mobx";
import {makeAutoObservable} from "mobx";
import {http} from "../utils/http";
export class Product {
@@ -7,6 +7,7 @@ export class Product {
data = [];
total_data = 0;
filterCategory = null;
visibleModalProduct = false;
pageCategories = 0;
pageSizeCategories = 10
@@ -46,15 +47,14 @@ export class Product {
}
}
@action
async create(data) {
const response = await http.post('/product', data);
const response = await http.post('/product').send(data);
await this.getData();
return response;
}
async update(id, data) {
const response = await http.put(`/product/${id}`, data);
const response = await http.put(`/product/${id}`).send(data);
await this.getData();
return response;
}