Merge branch 'develop' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend into develop
This commit is contained in:
commit
195e0e80e4
|
@ -32,11 +32,7 @@ export const MembershipModal = ({
|
||||||
form
|
form
|
||||||
.validateFields()
|
.validateFields()
|
||||||
.then((values) => {
|
.then((values) => {
|
||||||
let input = values;
|
onCreate(values);
|
||||||
if (initialData.id)
|
|
||||||
input.username = initialData.username;
|
|
||||||
|
|
||||||
onCreate(input);
|
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
})
|
})
|
||||||
.catch((info) => {
|
.catch((info) => {
|
||||||
|
|
|
@ -72,17 +72,21 @@ export const Product = observer(() => {
|
||||||
|
|
||||||
const uploadHandler = async (args) => {
|
const uploadHandler = async (args) => {
|
||||||
const file = args.file;
|
const file = args.file;
|
||||||
|
try {
|
||||||
const responseUpload = await store.product.uploadExcel(file);
|
const responseUpload = await store.product.uploadExcel(file);
|
||||||
|
|
||||||
if (responseUpload.status === 201) {
|
if (responseUpload.status === 201) {
|
||||||
message.success("Success upload excel!");
|
message.success("Success upload excel!");
|
||||||
} else {
|
} else {
|
||||||
message.error("Failed upload excel!");
|
message.error("Failed upload excel!");
|
||||||
setLoading(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const responseUploadProduct = await handleUploadProduct(responseUpload);
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
const responseUploadProduct = await handleUploadProduct(responseUpload);
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
message.error("Failed upload excel!");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChange = (info) => {
|
const handleChange = (info) => {
|
||||||
|
@ -94,15 +98,21 @@ export const Product = observer(() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUploadProduct = async (data) => {
|
const handleUploadProduct = async (data) => {
|
||||||
|
try {
|
||||||
const response = await store.product.uploadProduct({fileName: data.body.filename});
|
const response = await store.product.uploadProduct({fileName: data.body.filename});
|
||||||
|
|
||||||
if (response.status === 201) {
|
if (response.status === 201) {
|
||||||
message.success("Success Create Product by Excel!");
|
message.success("Success Create Product by Excel!");
|
||||||
} else {
|
} else {
|
||||||
message.error("Failed Create Product by Excel!");
|
message.error("Failed Create Product by Excel!");
|
||||||
setLoading(false);
|
|
||||||
}
|
}
|
||||||
|
setLoading(false);
|
||||||
|
await store.product.getData();
|
||||||
return response;
|
return response;
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
message.error("Failed Create Product by Excel!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadingState = (
|
const loadingState = (
|
||||||
|
|
|
@ -63,5 +63,6 @@ export class Authentication {
|
||||||
TokenUtil.clearAccessToken();
|
TokenUtil.clearAccessToken();
|
||||||
TokenUtil.persistToken();
|
TokenUtil.persistToken();
|
||||||
this.isLoggedIn = false;
|
this.isLoggedIn = false;
|
||||||
|
window.location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user