mirror of
https://github.com/csehviktor/status-monitor.git
synced 2026-04-28 16:27:34 +02:00
use dynamic urls
This commit is contained in:
@@ -20,8 +20,15 @@ export function getRealtimeData(): StatusMessage[] {
|
||||
return realtimeData ?? [];
|
||||
}
|
||||
|
||||
export async function getHistoricalData(url: string): Promise<StatusMessage[]> {
|
||||
return await fetch(url)
|
||||
export async function getHistoricalData(
|
||||
agent: string,
|
||||
period: string,
|
||||
): Promise<StatusMessage[]> {
|
||||
return await fetch(
|
||||
import.meta.env.DEV
|
||||
? `http://localhost:3000/agent/${agent}/${period}`
|
||||
: `/agent/${agent}`,
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((data) => data as StatusMessage[]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user