first commit of v.02 application

This commit is contained in:
KS Jannette
2026-05-07 23:20:30 -04:00
commit a6b0a95dfc
98 changed files with 21028 additions and 0 deletions

30
client/src/api/sources.js Normal file
View File

@@ -0,0 +1,30 @@
'use strict';
import { handleResponse } from './client.js';
const BASE = '/api/sources';
export async function listSources(notebookId) {
const res = await fetch(`${BASE}?notebookId=${notebookId}`);
return handleResponse(res);
}
export async function uploadSource(notebookId, file) {
const formData = new FormData();
formData.append('file', file);
formData.append('notebookId', notebookId);
const res = await fetch(BASE, {
method: 'POST',
body: formData,
});
return handleResponse(res);
}
export async function addUrlSource(notebookId, url) {
const res = await fetch(`${BASE}/url`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ notebookId, url }),
});
return handleResponse(res);
}