β
FiNavigation icon error - Replaced with FiMap
β
API configuration - Fixed undefined API base URL
β
Google Maps integration - Added proper error handling
Option A: Create .env file (Recommended)
- In your
FrontEnd/directory, create a file called.env - Add this line:
VITE_GOOGLE_MAPS_API_KEY=your_actual_google_maps_api_key_here
Option B: Edit the config file directly
- Open
FrontEnd/src/config/env.js - Replace
'YOUR_GOOGLE_MAPS_API_KEY_HERE'with your actual API key
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable these APIs:
- Google Maps JavaScript API
- Distance Matrix API
- Geocoding API
- Create an API key in "Credentials"
- Restrict the key to your domains:
http://localhost:3000/*http://localhost:5173/*https://off-campus-rooms.vercel.app/*
- In your
BackEnd/directory, create a file called.env - Add this line:
GOOGLE_API_KEY=your_actual_google_maps_api_key_here
In FrontEnd/src/config/env.js:
// Change this line:
export const GOOGLE_MAPS_API_KEY = 'YOUR_GOOGLE_MAPS_API_KEY_HERE';
// To your actual key:
export const GOOGLE_MAPS_API_KEY = 'AIzaSyC...'; // Your actual key here-
Check browser console - You should see:
API Configuration: { API_BASE_URL: "https://offcampusrooms.onrender.com", VITE_API_BASE_URL: "your_key_here", hostname: "off-campus-rooms.vercel.app" } -
Test FAQ creation - Should work without 405 errors
-
Test driver creation - Should work without 405 errors
-
Test Google Maps - Should load without InvalidKeyMapError
- Check that your backend is running
- Verify the API base URL is correct
- Check that the backend routes are properly configured
- Verify your API key is correct
- Check that the APIs are enabled in Google Cloud Console
- Verify domain restrictions are set correctly
- This should be fixed now
- If you still see it, clear your browser cache and reload
FrontEnd/
βββ .env β Create this with VITE_GOOGLE_MAPS_API_KEY
βββ src/
β βββ config/
β β βββ api.js β Fixed API configuration
β β βββ env.js β New environment config
β βββ pages/
β βββ StudentDashboard.jsx β Fixed icon imports
BackEnd/
βββ .env β Create this with GOOGLE_API_KEY
βββ server.js β Already fixed
- Frontend: Check if API config loads correctly
- Backend: Test if Google Maps API key is loaded
- Maps: Try to load a page with Google Maps
- Admin: Try to create a FAQ or driver
- Check the browser console for error messages
- Verify all environment variables are set
- Check that your Google Cloud project has billing enabled
- Ensure the APIs are enabled and the key is restricted properly
Once everything is working:
- β FAQ creation will work
- β Driver management will work
- β Google Maps will load properly
- β Student dashboard will work without errors
- β All API calls will use the correct base URL
Remember: Never commit your actual API keys to version control!