Update metrics-dialog.tsx

This commit is contained in:
MacRimi
2025-10-19 17:53:39 +02:00
parent 61a376fb6d
commit c0aa2b85fc

View File

@@ -46,7 +46,13 @@ export function MetricsView({ vmid, vmName, vmType, metricType, onBack }: Metric
console.log("[v0] Fetching metrics for VMID:", vmid, "Timeframe:", timeframe, "Type:", vmType)
try {
const response = await fetch(`http://localhost:8008/api/vms/${vmid}/metrics?timeframe=${timeframe}`)
const baseUrl =
typeof window !== "undefined" ? `${window.location.protocol}//${window.location.hostname}:8008` : ""
const apiUrl = `${baseUrl}/api/vms/${vmid}/metrics?timeframe=${timeframe}`
console.log("[v0] Fetching from URL:", apiUrl)
const response = await fetch(apiUrl)
console.log("[v0] Response status:", response.status)