wired in project isolation
This commit is contained in:
@@ -115,6 +115,24 @@ async function deleteProject(id) {
|
||||
if (!res.ok) throw new Error(`Failed to delete project: ${res.status}`);
|
||||
}
|
||||
|
||||
async function getProjectSessions(projectId) {
|
||||
const url = new URL(`${BASE_URL}/sessions`);
|
||||
url.searchParams.set('limit', 200); // generous upper bound
|
||||
url.searchParams.set('offset', 0);
|
||||
url.searchParams.set('projectId', projectId);
|
||||
|
||||
const res = await fetch(url.toString());
|
||||
if (!res.ok) throw new Error(`Failed to fetch project sessions: ${res.status}`);
|
||||
return res.json(); // returns array of session objects
|
||||
}
|
||||
|
||||
async function getProject(id) {
|
||||
const res = await fetch(`${BASE_URL}/projects/${id}`);
|
||||
if (res.status === 404) return null;
|
||||
if (!res.ok) throw new Error(`Failed to fetch project: ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSessionByExternalId,
|
||||
createSession,
|
||||
@@ -129,4 +147,6 @@ module.exports = {
|
||||
getProjects,
|
||||
updateProject,
|
||||
deleteProject,
|
||||
getProjectSessions,
|
||||
getProject,
|
||||
}
|
||||
Reference in New Issue
Block a user