still fixing UI issue
Some checks failed
CI / test-build (push) Has been cancelled

This commit is contained in:
2025-12-18 12:41:51 +07:00
parent d55206af82
commit 8b5183d98a
3 changed files with 56 additions and 36 deletions

View File

@@ -518,21 +518,19 @@ async function createPool(e) {
const data = await res.json().catch(() => null);
// Always refresh pool list after creation attempt, regardless of response
// Wait a moment for pool creation to complete
await new Promise(resolve => setTimeout(resolve, 1000));
await loadPools();
if (res.ok) {
closeModal('create-pool-modal');
e.target.reset();
// 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 {
// 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.`);
// Check if pool appears in the list (might have been created despite error)
const err = data?.error || 'Failed to create pool';
alert(`Error: ${err}\n\nNote: The pool list has been refreshed. Please check if the pool was created.`);
}
} catch (err) {
// On network error, still try to refresh to see if pool was created