saving project notes

This commit is contained in:
Storme-bit
2026-04-18 23:17:34 -07:00
parent ee8f5bb5f0
commit 1fc6e8a66d
2 changed files with 8 additions and 4 deletions

View File

@@ -132,11 +132,15 @@ export async function createProject({ name, description, colour, icon, isolated
return res.json();
}
export async function updateProject(id, { name, description, colour, icon, isolated }) {
export async function updateProject(id, fields = {}) {
// Convert isolated boolean to integer if present
const body = { ...fields };
if (body.isolated !== undefined) body.isolated = body.isolated ? 1 : 0;
const res = await fetch(`${BASE_URL}/projects/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, description, colour, icon, isolated: isolated ? 1 : 0}),
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`Failed to update project: ${res.status}`);
return res.json();

View File

@@ -100,11 +100,11 @@ async function getProjects() {
return res.json();
}
async function updateProject(id, { name, description, colour, icon }) {
async function updateProject(id, fields = {}) {
const res = await fetch(`${BASE_URL}/projects/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, description, colour, icon })
body: JSON.stringify(fields)
});
if (!res.ok) throw new Error(`Failed to update project: ${res.status}`);
return res.json();