fix: add error handling to context doc/fact load functions

This commit is contained in:
pyr0ball 2026-05-13 17:00:29 -07:00
parent e8a1e2d77d
commit 5f25d9a350

View file

@ -208,13 +208,19 @@ const error = ref<string | null>(null)
const newFact = ref({ category: 'service', key: '', value: '' })
async function loadDocs() {
try {
const r = await fetch(`${BASE}/api/context/docs`)
if (r.ok) docs.value = await r.json()
else error.value = `Failed to load documents (${r.status})`
} catch { error.value = 'Could not reach server' }
}
async function loadFacts() {
try {
const r = await fetch(`${BASE}/api/context/facts`)
if (r.ok) facts.value = await r.json()
else error.value = `Failed to load facts (${r.status})`
} catch { error.value = 'Could not reach server' }
}
async function doDelete(id: string) {