- Storage: nested object buckets per type, integrated next_id into meta, migration from old flat task:N key format, seeded default types (task/idea/note) - Server: /api/entry-types CRUD + /api/entries replacing /api/tasks, type validation, blocks deletion if entries exist - Frontend: dynamic nav per type, Entry_Type_Dialog, Entry_Dialog with type selector, type chip in All view, Manage Types view Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
async function req(method, path, body) {
|
|
const opts = { method, headers: {} };
|
|
if (body !== undefined) {
|
|
opts.headers['Content-Type'] = 'application/json';
|
|
opts.body = JSON.stringify(body);
|
|
}
|
|
const res = await fetch(path, opts);
|
|
const data = await res.json();
|
|
if (!data.ok) { throw new Error(data.error ?? 'Request failed'); }
|
|
return data;
|
|
}
|
|
|
|
export const get_entry_types = () => req('GET', '/api/entry-types');
|
|
export const create_entry_type = (body) => req('POST', '/api/entry-types', body);
|
|
export const update_entry_type = (id, body) => req('PUT', `/api/entry-types/${id}`, body);
|
|
export const delete_entry_type = (id) => req('DELETE', `/api/entry-types/${id}`);
|
|
|
|
export const get_entries = (type) => req('GET', type ? `/api/entries?type=${type}` : '/api/entries');
|
|
export const create_entry = (body) => req('POST', '/api/entries', body);
|
|
export const update_entry = (id, body) => req('PUT', `/api/entries/${id}`, body);
|
|
export const delete_entry = (id) => req('DELETE', `/api/entries/${id}`);
|
|
|
|
export const render_markdown = (text) => req('POST', '/api/render-markdown', { text });
|