This commit is contained in:
현성필
2024-05-13 20:55:27 +09:00
parent 028a1e5956
commit 94e1343040
+16
View File
@@ -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);