mirror of
https://github.com/thecyberlearn/quantum-ai-v2.git
synced 2026-08-18 14:12:59 +00:00
Fix critical wallet balance validation bug after balance updates
- Replace static template value with dynamic DOM-based balance reading - Use parseFloat(walletBalanceElement.textContent) for current balance - Ensures validation uses the actual displayed balance, not stale template value - Fixes false "insufficient balance" errors after successful transactions - Maintains consistency between display and validation logic - Prevents user confusion with inconsistent balance states This was a critical bug where users would see updated balance but still get insufficient balance errors due to static template rendering. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
64c2d98de9
commit
c81bdfbfe0
@ -1560,9 +1560,10 @@ document.addEventListener('keydown', function(e) {
|
||||
return;
|
||||
{% endif %}
|
||||
|
||||
// Check wallet balance
|
||||
const balance = {{ user.wallet_balance|default:0 }};
|
||||
if (balance < 4.00) {
|
||||
// Check wallet balance dynamically from DOM
|
||||
const walletBalanceElement = document.getElementById('walletBalance');
|
||||
const currentBalance = walletBalanceElement ? parseFloat(walletBalanceElement.textContent) : 0;
|
||||
if (currentBalance < 4.00) {
|
||||
AgentUtils.showToast('Insufficient balance! You need 4.00 AED.', 'error');
|
||||
setTimeout(() => {
|
||||
window.location.href = "{% url 'core:wallet' %}";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user