Skip to content

Commit

Permalink
AMP-2848: fix bug on creating item after creating collection
Browse files Browse the repository at this point in the history
  • Loading branch information
yingfeng-iu committed Oct 19, 2023
1 parent 3ea1e2a commit 70fe637
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/service/entity-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class EntityService {

}
if (!self.isCreatePage) {
self.collectionService.updateCollection(self.entity).then(reponse => {
self.collectionService.updateCollection(self.entity).then(response => {
self.$bvToast.toast("Collection details updated successfully", self.sharedService.successToastConfig);
self.submitted = false;
self.isDataChanged = false;
Expand All @@ -51,11 +51,15 @@ export default class EntityService {
});
} else {
self.entity.unit = self.baseService.API_URL + `/units/${self.selectedUnit.id}`;
self.collectionService.createCollection(self.entity).then(reponse => {
self.collectionService.createCollection(self.entity).then(response => {
self.$bvToast.toast("Collection created successfully", self.sharedService.successToastConfig);
// self.showEdit = !self.showEdit;
self.entity = response;
self.selectedCollection = response;
self.selectedCollection.selectedCollectionId = response.id;
self.submitted = false;
self.isDataChanged = false;
console.log("collection.id = " + self.entity.id);
console.log("selectedCollectionId = " + self.selectedCollection.selectedCollectionId);
}).catch(error => {
self.submitted = false;
if (error.response && error.response.data && error.response.data.validationErrors) {
Expand All @@ -75,7 +79,7 @@ export default class EntityService {
}
self.showLoader = true;
const payload = { name: self.entity.name, description: self.entity.description };
self.primaryFileService.updatePrimaryFile(self.entity.id, payload).then(reponse => {
self.primaryFileService.updatePrimaryFile(self.entity.id, payload).then(response => {
self.showLoader = false;
self.submitted = false;
self.$bvToast.toast("File details has been updated successfully", { title: 'Notification', appendToast: true, variant: "success", autoHideDelay: 5000 });
Expand Down

0 comments on commit 70fe637

Please sign in to comment.