feat: system tools and admin enhancements
This commit is contained in:
@@ -62,6 +62,12 @@ export async function registerUser({ email, username, plainPassword }) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function logoutUser() {
|
||||
return apiFetch('/logout', {
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
export async function listRootForums() {
|
||||
return getCollection('/forums?parent[exists]=false')
|
||||
}
|
||||
@@ -109,6 +115,20 @@ export async function fetchVersion() {
|
||||
return apiFetch('/version')
|
||||
}
|
||||
|
||||
export async function fetchVersionCheck() {
|
||||
return apiFetch('/version/check')
|
||||
}
|
||||
|
||||
export async function runSystemUpdate() {
|
||||
return apiFetch('/system/update', {
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
export async function fetchSystemStatus() {
|
||||
return apiFetch('/system/status')
|
||||
}
|
||||
|
||||
export async function fetchStats() {
|
||||
return apiFetch('/stats')
|
||||
}
|
||||
@@ -253,6 +273,23 @@ export async function getThread(id) {
|
||||
return apiFetch(`/threads/${id}`)
|
||||
}
|
||||
|
||||
export async function deleteThread(id, payload = null) {
|
||||
return apiFetch(`/threads/${id}`, {
|
||||
method: 'DELETE',
|
||||
...(payload ? { body: JSON.stringify(payload) } : {}),
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateThread(id, payload) {
|
||||
return apiFetch(`/threads/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/merge-patch+json',
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateThreadSolved(threadId, solved) {
|
||||
return apiFetch(`/threads/${threadId}/solved`, {
|
||||
method: 'PATCH',
|
||||
@@ -351,10 +388,32 @@ export async function listPostsByThread(threadId) {
|
||||
return getCollection(`/posts?thread=/api/threads/${threadId}`)
|
||||
}
|
||||
|
||||
export async function updatePost(id, payload) {
|
||||
return apiFetch(`/posts/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/merge-patch+json',
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
}
|
||||
|
||||
export async function deletePost(id, payload = null) {
|
||||
return apiFetch(`/posts/${id}`, {
|
||||
method: 'DELETE',
|
||||
...(payload ? { body: JSON.stringify(payload) } : {}),
|
||||
})
|
||||
}
|
||||
|
||||
export async function listUsers() {
|
||||
return getCollection('/users')
|
||||
}
|
||||
|
||||
export async function listAuditLogs(limit = 200) {
|
||||
const query = Number.isFinite(limit) ? `?limit=${limit}` : ''
|
||||
return getCollection(`/audit-logs${query}`)
|
||||
}
|
||||
|
||||
export async function listRanks() {
|
||||
return getCollection('/ranks')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user