This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user