Forum tree model, i18n, and frontend updates

This commit is contained in:
Micha
2025-12-24 13:15:02 +01:00
parent 98a2f1d536
commit 193273c843
29 changed files with 1115 additions and 218 deletions

View File

@@ -50,16 +50,20 @@ export async function registerUser({ email, username, plainPassword }) {
})
}
export async function listCategories() {
return getCollection('/categories')
export async function listRootForums() {
return getCollection('/forums?parent[exists]=false')
}
export async function getCategory(id) {
return apiFetch(`/categories/${id}`)
export async function listForumsByParent(parentId) {
return getCollection(`/forums?parent=/api/forums/${parentId}`)
}
export async function listThreadsByCategory(categoryId) {
return getCollection(`/threads?category=/api/categories/${categoryId}`)
export async function getForum(id) {
return apiFetch(`/forums/${id}`)
}
export async function listThreadsByForum(forumId) {
return getCollection(`/threads?forum=/api/forums/${forumId}`)
}
export async function getThread(id) {
@@ -70,13 +74,13 @@ export async function listPostsByThread(threadId) {
return getCollection(`/posts?thread=/api/threads/${threadId}`)
}
export async function createThread({ title, body, categoryId }) {
export async function createThread({ title, body, forumId }) {
return apiFetch('/threads', {
method: 'POST',
body: JSON.stringify({
title,
body,
category: `/api/categories/${categoryId}`,
forum: `/api/forums/${forumId}`,
}),
})
}