Repair Menu
This commit is contained in:
@@ -83,7 +83,6 @@ export const ProductComponent = observer((props) => {
|
||||
title: "Supplier",
|
||||
dataIndex: "supplier_name",
|
||||
key: "supplier_name",
|
||||
|
||||
},
|
||||
{
|
||||
title: "Sub Category",
|
||||
@@ -108,15 +107,17 @@ export const ProductComponent = observer((props) => {
|
||||
key: "action",
|
||||
render: (text, record) => (
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await store.product.getDetail(record.product_id);
|
||||
await store.product.getDetailProduct(record.product_id);
|
||||
history.push(LINKS.PRODUCT_DETAIL.replace(":id", record.product_id));
|
||||
//console.log(record.product_id);
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
</Button>
|
||||
onClick={async () => {
|
||||
await store.product.getDetail(record.product_id);
|
||||
await store.product.getDetailProduct(record.product_id);
|
||||
history.push(
|
||||
LINKS.PRODUCT_DETAIL.replace(":id", record.product_id)
|
||||
);
|
||||
//console.log(record.product_id);
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -160,12 +161,14 @@ export const ProductComponent = observer((props) => {
|
||||
if (idData !== "") {
|
||||
modalLoader.setLoading(true);
|
||||
try {
|
||||
const response=await store.product.update(idData, data);
|
||||
const response = await store.product.update(idData, data);
|
||||
response?.body?.statusCode === 201 || response?.body?.statusCode === 200
|
||||
? message.success("Berhasil Ubah Data Produk")
|
||||
: message.error("Gagal Ubah Data Produk");
|
||||
? message.success(
|
||||
response?.body?.message || "Berhasil Ubah Data Produk"
|
||||
)
|
||||
: message.error(response?.body?.message || "Gagal Ubah Data Produk");
|
||||
} catch (e) {
|
||||
message.error("Gagal Ubah Data Produk");
|
||||
message.error(e.response?.body?.message || "Gagal Ubah Data Produk");
|
||||
}
|
||||
modalLoader.setLoading(false);
|
||||
store.product.visibleModalProduct = false;
|
||||
@@ -174,13 +177,13 @@ export const ProductComponent = observer((props) => {
|
||||
} else {
|
||||
modalLoader.setLoading(true);
|
||||
try {
|
||||
const response=await store.product.create(data);
|
||||
const response = await store.product.create(data);
|
||||
response?.body?.statusCode === 201 || response?.body?.statusCode === 200
|
||||
? message.success("Berhasil Tambah Produk")
|
||||
: message.error("Gagal Tambah Produk");
|
||||
? message.success(response?.body?.message || "Berhasil Tambah Produk")
|
||||
: message.error(response?.body?.message || "Gagal Tambah Produk");
|
||||
} catch (e) {
|
||||
console.log(e, "apa errornya");
|
||||
message.error("Gagal Tambah Produk");
|
||||
message.error(e.response?.body?.message || "Gagal Tambah Produk");
|
||||
}
|
||||
modalLoader.setLoading(false);
|
||||
store.product.visibleModalProduct = false;
|
||||
|
||||
Reference in New Issue
Block a user