This commit is contained in:
Team3
2026-05-25 18:43:17 +02:00
parent 145b3b25d5
commit 1cef392892
29 changed files with 3482 additions and 0 deletions

36
frontend/src/api.js Normal file
View File

@@ -0,0 +1,36 @@
const BASE = '/api'
export async function fetchGuides() {
const res = await fetch(`${BASE}/guides`)
return res.json()
}
export async function fetchGuide(id) {
const res = await fetch(`${BASE}/guides/${id}`)
return res.json()
}
export async function createGuide(topic, format) {
const res = await fetch(`${BASE}/guides`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ topic, format }),
})
return res.json()
}
export async function cancelGuide(id) {
await fetch(`${BASE}/guides/${id}/cancel`, { method: 'POST' })
}
export async function deleteGuide(id) {
await fetch(`${BASE}/guides/${id}`, { method: 'DELETE' })
}
export function pdfUrl(id) {
return `${BASE}/guides/${id}/pdf`
}
export function htmlUrl(id) {
return `${BASE}/guides/${id}/html`
}