Add pending apps and frontend components
- apps/captain-mobile: Mobile API service - apps/flow-ui: Flow UI application - apps/mindlink: Mindlink application - apps/storage: Storage API and workers - apps/tzzr-cli: TZZR CLI tool - deck-frontend/backups: Historical TypeScript versions - hst-frontend: Standalone HST frontend Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
81
hst-frontend/js/api.js
Normal file
81
hst-frontend/js/api.js
Normal file
@@ -0,0 +1,81 @@
|
||||
// === API FUNCTIONS ===
|
||||
|
||||
async function fetchTags() {
|
||||
try {
|
||||
const r = await fetch(`${API}/${state.base}?order=ref.asc`);
|
||||
state.tags = r.ok ? await r.json() : [];
|
||||
} catch(e) {
|
||||
state.tags = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchGroups() {
|
||||
try {
|
||||
const r = await fetch(`${API}/api_groups`);
|
||||
state.groups = r.ok ? await r.json() : [];
|
||||
} catch(e) {
|
||||
state.groups = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchLibraries() {
|
||||
try {
|
||||
const r = await fetch(`${API}/api_library_list`);
|
||||
state.libraries = r.ok ? await r.json() : [];
|
||||
} catch(e) {
|
||||
state.libraries = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchGraphEdges() {
|
||||
try {
|
||||
const r = await fetch(`${API}/graph_hst`);
|
||||
state.graphEdges = r.ok ? await r.json() : [];
|
||||
} catch(e) {
|
||||
state.graphEdges = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchTreeEdges() {
|
||||
try {
|
||||
const r = await fetch(`${API}/tree_hst`);
|
||||
state.treeEdges = r.ok ? await r.json() : [];
|
||||
} catch(e) {
|
||||
state.treeEdges = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchLibraryMembers(mrf) {
|
||||
try {
|
||||
const r = await fetch(`${API}/library_hst?mrf_library=eq.${mrf}`);
|
||||
return r.ok ? (await r.json()).map(d => d.mrf_tag) : [];
|
||||
} catch(e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchChildren(mrf) {
|
||||
try {
|
||||
const r = await fetch(`${API}/rpc/api_children`, {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify({parent_mrf: mrf})
|
||||
});
|
||||
return r.ok ? await r.json() : [];
|
||||
} catch(e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchRelated(mrf) {
|
||||
try {
|
||||
const r = await fetch(`${API}/rpc/api_related`, {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify({tag_mrf: mrf})
|
||||
});
|
||||
return r.ok ? await r.json() : [];
|
||||
} catch(e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user