get sessions by projectId

This commit is contained in:
Storme-bit
2026-04-14 01:07:59 -07:00
parent 8d4a553a2a
commit 7598e8b9f4
5 changed files with 37 additions and 18 deletions

View File

@@ -4,8 +4,13 @@ const BASE_URL = import.meta.env.VITE_ORCHESTRATION_URL ?? '';
// ── Sessions ────────────────────────────────────────────────
export async function fetchSessions(limit = API_DEFAULTS.SESSIONS_LIMIT, offset = API_DEFAULTS.OFFSET) {
const res = await fetch(`${BASE_URL}/sessions?limit=${limit}&offset=${offset}`);
export async function fetchSessions(limit = API_DEFAULTS.SESSIONS_LIMIT, offset = API_DEFAULTS.OFFSET, projectId = null) {
const url = new URL(`${BASE_URL}/sessions`, window.location.origin);
url.searchParams.set('limit', limit);
url.searchParams.set('offset', offset);
if (projectId) url.searchParams.set('projectId', projectId);
const res = await fetch(url.toString());
if (!res.ok) throw new Error(`Failed to fetch sessions: ${res.status}`);
return res.json();
}