diff --git a/ApiTestManager/src/APITester.js b/ApiTestManager/src/APITester.js index 2378cdc..188d6e6 100644 --- a/ApiTestManager/src/APITester.js +++ b/ApiTestManager/src/APITester.js @@ -763,11 +763,27 @@ class APITester { let model = this.apiRequests[index]; me.showLoadingOverlay(); + this.currentAjaxRequest = $.ajax({ url: this.getAPISaveURL(model.collectionId), type: 'POST', contentType: 'application/json', data: JSON.stringify(model), success: function(data) { let message = '저장되었습니다.'; $('.toast-body').text(message); $('.toast').toast('show'); + let collection = me.collections.find(function(collection) { + return collection.id === model.collectionId; + }); + + if (collection) { + // Assuming each API in the collection.apis array has an 'id' you want to match with model.id + let apiIndex = collection.apis.findIndex(api => api.id === model.id); + if (apiIndex !== -1) { + collection.apis[apiIndex] = model; // Replace the API with the model + } else { + console.log("API not found in the collection."); + } + } else { + console.log("Collection not found."); + } }, error: function(response, textStatus, errorThrown) { me.hideLoadingOverlay(); $('.toast-body').text(response.responseJSON.error);