Bug Fixing Create New Supplier Menu Supplier
This commit is contained in:
parent
cc930cd195
commit
211e6b401c
|
@ -190,31 +190,34 @@ export const SupplierComponent = observer((props) => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
modalLoader.setLoading(true);
|
|
||||||
const response = await store.supplier.create(data);
|
const response = await store.supplier.create(data);
|
||||||
console.log(response)
|
if (response.status === 201) {
|
||||||
response?.body?.statusCode === 201 && response?.body?.statusCode === 200
|
message.success(
|
||||||
? message.success(
|
response?.body?.message || "Berhasil Tambah Supplier"
|
||||||
response?.body?.message || "Berhasil Tambah Supplier Baru"
|
);
|
||||||
)
|
await store.supplier.getData();
|
||||||
: message.error(
|
} else {
|
||||||
response?.body?.error
|
message.error(response?.body?.error || "Gagal Tambah Supplier", 3);
|
||||||
? response?.body?.error || "Supplier Sudah Ada"
|
}
|
||||||
: response?.body?.message || "Gagal Tambah Supplier Baru"
|
|
||||||
// response?.body?.statusCode === 406
|
|
||||||
// ? response?.body?.error || "Supplier Sudah Ada"
|
|
||||||
// : response?.body?.message || "Gagal Tambah Supplier Baru"
|
|
||||||
//response?.body?.message || "Gagal Tambah Supplier Baru"
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log("testingan");
|
||||||
|
console.log(e.response, "testingan");
|
||||||
|
console.log(e.result, "testingan1");
|
||||||
|
if (e.response?.body?.error) {
|
||||||
|
message.error(e.response.body.error);
|
||||||
|
modalLoader.setLoading(false);
|
||||||
|
store.supplier.visibleModalSupplier = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log(e, "apa errornya");
|
console.log(e, "apa errornya");
|
||||||
message.error(e.response?.body?.message || "Gagal Tambah Supplier");
|
message.error("Gagal Beli Product");
|
||||||
}
|
}
|
||||||
|
|
||||||
modalLoader.setLoading(false);
|
modalLoader.setLoading(false);
|
||||||
store.supplier.visibleModalSupplier = false;
|
store.supplier.visibleModalSupplier = false;
|
||||||
setIdData("");
|
setIdData("");
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
|
await store.supplier.getData();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,13 +38,13 @@ export class Supplier {
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(data) {
|
async create(data) {
|
||||||
try {
|
// try {
|
||||||
const response = await http.post('/users/supplier').send(data);
|
const response = await http.post('/users/supplier').send(data);
|
||||||
await this.getData();
|
//await this.getData();
|
||||||
return response;
|
return response;
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
console.error(e);
|
// console.error(e);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
async createTransaction(data) {
|
async createTransaction(data) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user