fix(disk-monitoring): use correct admin_token from localStorage
Fix authentication error in disk monitoring dashboard: - Change from 'token' to 'admin_token' for consistency with admin system - Add check for missing token with user-friendly error message - Prevents 401 errors when admin is logged in Fixes: Failed to fetch metrics: 401 (Unauthorized) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ad36caf8cb
commit
493e540437
1 changed files with 5 additions and 1 deletions
|
|
@ -11,7 +11,11 @@ async function loadMetrics() {
|
||||||
metricsContainer.classList.add('hidden');
|
metricsContainer.classList.add('hidden');
|
||||||
errorDiv.classList.add('hidden');
|
errorDiv.classList.add('hidden');
|
||||||
|
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('admin_token');
|
||||||
|
if (!token) {
|
||||||
|
throw new Error('Not authenticated. Please log in.');
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch('/api/admin/disk-metrics', {
|
const response = await fetch('/api/admin/disk-metrics', {
|
||||||
headers: { 'Authorization': 'Bearer ' + token }
|
headers: { 'Authorization': 'Bearer ' + token }
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue