get sessions by projectId
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user