fix: handler error buy producy

This commit is contained in:
caturbgs 2021-12-21 16:16:27 +07:00
parent 757c0c291e
commit 88260e97b2

View File

@ -61,12 +61,16 @@ export const Product = observer(() => {
modalLoader.setLoading(true);
try {
const response = await store.transaction.buyProduct({productCode: data});
// if (response.status === 200) {
message.success("Success Buy Product");
// } else {
//message.error("Failed Buy Product");
//}
if (response.status === 200) {
message.success("Success Buy Product");
} else {
message.error("Failed Buy Product", 3);
}
} catch (e) {
if (e.response?.body?.message) {
message.error(e.response.body.message);
return;
}
console.log(e, "apa errornya");
message.error("Failed Buy Product");
}
@ -148,11 +152,11 @@ export const Product = observer(() => {
</Row>
)}
{productData.length !== 0 && (
<Col style={{textAlign: "right"}}>
<Button style={{backgroundColor: "#2D9CDB", color: "white"}}>
Beli Sekarang
</Button>
</Col>
<Col style={{textAlign: "right", marginTop: "1em"}}>
<Button style={{backgroundColor: "#2D9CDB", color: "white"}}>
Beli Sekarang
</Button>
</Col>
)}
</div>
);