Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 3,699 Bytes
896453f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | <!DOCTYPE html>
<html>
<head>
<title>Dropdown Debug Tool</title>
<style>
body { font-family: Arial; padding: 20px; }
.success { color: green; }
.error { color: red; }
.info { color: blue; }
button { padding: 10px 20px; margin: 10px; font-size: 16px; }
pre { background: #f4f4f4; padding: 10px; border-radius: 5px; overflow-x: auto; }
</style>
</head>
<body>
<h1>π CareQuest Dropdown Debug Tool</h1>
<h2>Step 1: Clear Browser Cache</h2>
<button onclick="clearCache()">Clear All Cache & Reload</button>
<div id="cache-status"></div>
<h2>Step 2: Test API Direct</h2>
<button onclick="testAPI()">Test API Endpoint</button>
<div id="api-status"></div>
<pre id="api-results"></pre>
<h2>Step 3: Check Location Context</h2>
<p>Open browser console (F12) and check localStorage:</p>
<pre>localStorage.getItem('user_location')</pre>
<p class="info">Should contain: {"state":"MA","city":"Boston",...}</p>
<h2>Step 4: Instructions</h2>
<ol>
<li>Click "Clear All Cache & Reload" button above</li>
<li>Go to http://localhost:5173</li>
<li>Click the "Find My Community" tab</li>
<li>Enter "Boston, MA" in the address lookup</li>
<li>Click "Search Topics" tab</li>
<li>Type "Care" in the search box</li>
<li>Open browser console (F12) and look for logs starting with π [HomeModern]</li>
</ol>
<script>
async function clearCache() {
const status = document.getElementById('cache-status');
try {
// Clear localStorage
localStorage.clear();
sessionStorage.clear();
// Clear caches
if ('caches' in window) {
const cacheNames = await caches.keys();
await Promise.all(cacheNames.map(name => caches.delete(name)));
}
status.innerHTML = '<p class="success">β
Cache cleared! Reloading page in 2 seconds...</p>';
setTimeout(() => {
window.location.href = 'http://localhost:5173';
}, 2000);
} catch (error) {
status.innerHTML = '<p class="error">β Error clearing cache: ' + error.message + '</p>';
}
}
async function testAPI() {
const status = document.getElementById('api-status');
const results = document.getElementById('api-results');
status.innerHTML = '<p class="info">β³ Testing API...</p>';
try {
const response = await fetch('/api/search/?q=Care&types=organizations&limit=5&state=MA');
const data = await response.json();
const orgs = data.results.organizations;
const carequest = orgs.find(org => org.title.includes('CAREQUEST'));
if (carequest) {
status.innerHTML = '<p class="success">β
API is returning CareQuest correctly!</p>';
results.textContent = JSON.stringify(carequest, null, 2);
} else {
status.innerHTML = '<p class="error">β CareQuest NOT in API results!</p>';
results.textContent = JSON.stringify(data, null, 2);
}
} catch (error) {
status.innerHTML = '<p class="error">β API Error: ' + error.message + '</p>';
results.textContent = error.stack;
}
}
</script>
</body>
</html>
|