# Transactions Troubleshooting Guide ## Issue: No Transactions Showing If you're seeing no transactions on the `/transactions` page, follow these steps: ## Step 1: Verify You're Logged In The transactions page requires authentication. Make sure you: 1. **Are logged in via Steam** on the frontend 2. **Have a valid JWT token** in your cookies 3. **The session is active** in the database ### Quick Check: ```javascript // Open browser console (F12) and run: console.log(document.cookie); // Should show: accessToken=... and refreshToken=... ``` If no tokens are present, **log in again via Steam**. ## Step 2: Clear Old Mock Sessions The seed script initially created **mock sessions with fake tokens**. These won't work because they're not valid JWTs. ### Delete Mock Sessions: ```javascript // In MongoDB or using a script: db.sessions.deleteMany({ token: /^mock_token_/ }); ``` ### Or via Node: ```bash node -e " import('mongoose').then(async mongoose => { await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/turbotrades'); const Session = (await import('./models/Session.js')).default; const result = await Session.deleteMany({ token: /^mock_token_/ }); console.log('Deleted', result.deletedCount, 'mock sessions'); await mongoose.disconnect(); process.exit(0); }); " ``` ## Step 3: Re-Login and Re-Seed 1. **Login via Steam** on the frontend (`http://localhost:5173`) 2. **Verify you're logged in** (check profile page) 3. **Delete existing fake transactions** (optional): ```javascript node -e " import('mongoose').then(async mongoose => { await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/turbotrades'); const Transaction = (await import('./models/Transaction.js')).default; const result = await Transaction.deleteMany({}); console.log('Deleted', result.deletedCount, 'transactions'); await mongoose.disconnect(); process.exit(0); }); " ``` 4. **Run the seed script again**: ```bash node seed-transactions.js ``` The seed script now **only uses real sessions** with valid JWT tokens. ## Step 4: Verify Transactions in Database ```bash node -e " import('mongoose').then(async mongoose => { await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/turbotrades'); const User = (await import('./models/User.js')).default; const Transaction = (await import('./models/Transaction.js')).default; const user = await User.findOne().sort({ createdAt: -1 }); console.log('User:', user.username, '- ID:', user._id); const transactions = await Transaction.find({ userId: user._id }); console.log('Transactions:', transactions.length); if (transactions.length > 0) { console.log('Sample:', transactions[0].type, transactions[0].amount); } await mongoose.disconnect(); process.exit(0); }); " ``` ## Step 5: Check Browser Console Open browser DevTools (F12) and look for: ``` 🔄 Fetching transactions... ✅ Transaction response: { success: true, transactions: [...], stats: {...} } 📊 Loaded 28 transactions ``` ### Common Errors: **401 Unauthorized:** - Not logged in or token expired - Solution: Log in again via Steam **500 Server Error:** - Check backend console for errors - Verify MongoDB is running **Empty Array:** - Transactions exist but for a different user - Solution: Delete transactions and re-seed after logging in ## Step 6: Check Backend Console Backend should show: ``` 📊 Fetching transactions for user: 6961b31dadcc335cb645e95f ✅ Found 28 transactions 📈 Stats: { totalDeposits: ..., ... } ``` If you see: ``` ✅ Found 0 transactions ``` Then transactions don't exist for your logged-in user. Re-run seed script. ## Dropdown Styling Issue The dropdowns were using a non-existent `input-field` class. This has been **fixed** with proper Tailwind classes: ```vue