From 94e134304068466ad4cb7f0fab227d4db0a9ebca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=98=84=EC=84=B1=ED=95=84?= Date: Mon, 13 May 2024 20:55:27 +0900 Subject: [PATCH] =?UTF-8?q?UI=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ApiTestManager/src/APITester.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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);