fix: clone — apiFetch → requestJSON (v1.3.82)

This commit is contained in:
“Naeel”
2026-05-09 20:35:26 +04:00
parent 0a4f64143c
commit 26728aadbe
3 changed files with 5 additions and 14 deletions
+2 -11
View File
@@ -447,22 +447,13 @@ async function submitClone() {
if (errEl) errEl.style.display = 'none';
try {
var resp = await apiFetch('/functions/' + encodeURIComponent(srcName) + '/clone', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({new_name: newName})
});
var data = await resp.json();
if (!resp.ok) {
if (errEl) { errEl.textContent = data.error || ('Ошибка ' + resp.status); errEl.style.display = 'block'; }
return;
}
var data = await requestJSON(API_BASE + '/functions/' + encodeURIComponent(srcName) + '/clone', 'POST', {new_name: newName});
// Успех — закрываем модалку, обновляем список
closeEdit();
setStatus('Функция «' + newName + '» создана как копия «' + srcName + '»', false);
await reloadAll();
} catch(e) {
if (errEl) { errEl.textContent = 'Сетевая ошибка: ' + e.message; errEl.style.display = 'block'; }
if (errEl) { errEl.textContent = e.message; errEl.style.display = 'block'; }
} finally {
if (btn) { btn.disabled = false; btn.textContent = 'Клонировать'; }
}