This commit is contained in:
Team3
2026-05-27 01:00:33 +02:00
parent ad2f3e4786
commit 351f330db0
10 changed files with 1184 additions and 13 deletions

View File

@@ -43,3 +43,44 @@ export function pdfUrl(id) {
export function htmlUrl(id) {
return `${BASE}/guides/${id}/html`
}
export async function fetchBausteine(topic) {
const res = await fetch(`${BASE}/bausteine?topic=${encodeURIComponent(topic)}`)
return res.json()
}
export async function createBaustein(topic, title) {
const res = await fetch(`${BASE}/bausteine`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ topic, title }),
})
return res.json()
}
export async function deleteBaustein(id) {
await fetch(`${BASE}/bausteine/${id}`, { method: 'DELETE' })
}
export async function fetchSuggestions(topic) {
const res = await fetch(`${BASE}/bausteine/suggestions?topic=${encodeURIComponent(topic)}`)
return res.json()
}
export async function generateSuggestions(topic) {
await fetch(`${BASE}/bausteine/suggestions/generate?topic=${encodeURIComponent(topic)}`, { method: 'POST' })
}
export async function fetchSuggestionsStatus(topic) {
const res = await fetch(`${BASE}/bausteine/suggestions/status?topic=${encodeURIComponent(topic)}`)
return res.json()
}
export async function addSuggestion(id) {
const res = await fetch(`${BASE}/bausteine/suggestions/${id}/add`, { method: 'POST' })
return res.json()
}
export async function ignoreSuggestion(id) {
await fetch(`${BASE}/bausteine/suggestions/${id}/ignore`, { method: 'POST' })
}