Skip to content

Commit 6827985

Browse files
committed
refactor: pass panel element to executeRequest instead of operationId
Signed-off-by: Yash-Raj-5424 <myash3499@gmail.com>
1 parent 2cb7b86 commit 6827985

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

static/js/rest-api-executor.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ class RESTAPIExecutor {
2626
buttons.forEach(button => {
2727
button.addEventListener('click', (e) => {
2828
e.preventDefault();
29-
const operationId = button.dataset.operationId;
30-
this.executeRequest(operationId);
29+
const operationPanel = button.closest('[data-operation-panel]');
30+
if (operationPanel) {
31+
this.executeRequest(operationPanel);
32+
}
3133
});
3234
});
3335
}
@@ -53,13 +55,12 @@ class RESTAPIExecutor {
5355
}
5456

5557
/**
56-
* Execute an API request for the given operation
57-
* @param {string} operationId - The ID of the operation to execute
58+
* Execute an API request for the given operation panel
59+
* @param {Element} operationPanel - The operation panel element
5860
*/
59-
async executeRequest(operationId) {
60-
const operationPanel = document.querySelector(`[data-operation-id="${operationId}"]`);
61+
async executeRequest(operationPanel) {
6162
if (!operationPanel) {
62-
console.error(`Operation panel not found for ${operationId}`);
63+
console.error('Operation panel not found');
6364
return;
6465
}
6566

0 commit comments

Comments
 (0)