feat: crud product
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user