This commit is contained in:
ajat91.sudrajat 2021-12-23 17:05:44 +07:00
commit 195e0e80e4
3 changed files with 26 additions and 19 deletions

View File

@ -32,11 +32,7 @@ export const MembershipModal = ({
form
.validateFields()
.then((values) => {
let input = values;
if (initialData.id)
input.username = initialData.username;
onCreate(input);
onCreate(values);
form.resetFields();
})
.catch((info) => {

View File

@ -72,17 +72,21 @@ export const Product = observer(() => {
const uploadHandler = async (args) => {
const file = args.file;
try {
const responseUpload = await store.product.uploadExcel(file);
if (responseUpload.status === 201) {
message.success("Success upload excel!");
} else {
message.error("Failed upload excel!");
setLoading(false);
}
const responseUploadProduct = await handleUploadProduct(responseUpload);
setLoading(false);
const responseUploadProduct = await handleUploadProduct(responseUpload);
} catch (e) {
setLoading(false);
message.error("Failed upload excel!");
}
};
const handleChange = (info) => {
@ -94,15 +98,21 @@ export const Product = observer(() => {
};
const handleUploadProduct = async (data) => {
try {
const response = await store.product.uploadProduct({fileName: data.body.filename});
if (response.status === 201) {
message.success("Success Create Product by Excel!");
} else {
message.error("Failed Create Product by Excel!");
setLoading(false);
}
setLoading(false);
await store.product.getData();
return response;
} catch (e) {
setLoading(false);
message.error("Failed Create Product by Excel!");
}
}
const loadingState = (

View File

@ -63,5 +63,6 @@ export class Authentication {
TokenUtil.clearAccessToken();
TokenUtil.persistToken();
this.isLoggedIn = false;
window.location.reload();
}
}