still working on the UI error
Some checks failed
CI / test-build (push) Has been cancelled

This commit is contained in:
2025-12-18 12:33:08 +07:00
parent b335b0d9f3
commit d55206af82
3 changed files with 56 additions and 12 deletions

View File

@@ -516,16 +516,28 @@ async function createPool(e) {
})
});
const data = await res.json().catch(() => null);
if (res.ok) {
closeModal('create-pool-modal');
e.target.reset();
loadPools();
// Wait a moment for pool to be fully created, then refresh
await new Promise(resolve => setTimeout(resolve, 500));
await loadPools();
alert('Pool created successfully');
} else {
const err = await res.json();
alert(`Error: ${err.error || 'Failed to create pool'}`);
// Even if error, check if pool was actually created
// Sometimes creation reports error but pool exists
await new Promise(resolve => setTimeout(resolve, 1000));
await loadPools();
const err = await res.json().catch(() => ({ error: 'Failed to create pool' }));
alert(`Error: ${err.error || 'Failed to create pool'}\n\nNote: Please check if the pool was created despite the error.`);
}
} catch (err) {
// On network error, still try to refresh to see if pool was created
await new Promise(resolve => setTimeout(resolve, 1000));
await loadPools();
alert(`Error: ${err.message}`);
}
}