Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.62 KB

File metadata and controls

67 lines (48 loc) · 1.62 KB

✅ API FIX DEPLOYED!

What Was Wrong

The frontend was calling:

/api/admin/get-institution?institutionId=NRQywtfXzohZEl6rvT5B2jFb8oz2

But should have been calling:

/api/admin/get-institution?adminUserId=NRQywtfXzohZEl6rvT5B2jFb8oz2

The API expects adminUserId to look up which institution the admin owns!


What I Fixed

  1. ✅ Changed API call to use adminUserId parameter
  2. ✅ Handle 404 response gracefully (means no institution created yet)
  3. ✅ Fall back to personal stats if no institution exists
  4. ✅ Updated response parsing to match API structure

🚀 TEST NOW:

  1. Hard refresh (Ctrl + F5) on https://rretoriq25.web.app
  2. Navigate to Dashboard

Expected Behavior:

FIRST TIME (No Institution Yet):

  • Dashboard shows your personal stats (0 sessions, 0%, etc.)
  • No institution banner appears
  • Console shows: ⚠️ No institution found - admin needs to create institution first

AFTER Creating Institution:

  1. Go to /admin/dashboard
  2. Fill in:
    • Institution Name: "MUJ"
    • Seats Purchased: 100
  3. Click "Update Institution"
  4. Go back to /dashboard
  5. NOW you'll see:
    • 🏢 Blue institution banner with "MUJ"
    • Total Students count
    • Aggregated stats from all students

📝 ACTION REQUIRED:

You MUST create the institution first!

Steps:

  1. Click "Dashboard" in sidebar (to verify no errors)
  2. Click to /admin/dashboard in the URL or from the admin portal
  3. Fill in institution details
  4. Click "Update Institution"
  5. Return to /dashboard to see the institution view

Try it now and let me know if the errors are gone!