Refactor backend and frontend cleanup paths

This commit is contained in:
curo1305
2026-06-16 11:50:17 +02:00
parent 6b56763689
commit e97ca164d7
29 changed files with 1106 additions and 2280 deletions
+5 -10
View File
@@ -5,7 +5,7 @@
* DocumentPreviewModal.vue, FileManagerView.vue, CloudFolderView.vue
*/
import { request, fetchWithRetry } from './utils.js'
import { request, fetchWithRetry, jsonRequest } from './utils.js'
export function listDocuments({ topic, page = 1, perPage = 20, folderId = null, q = null, sort = null, order = null } = {}) {
const params = new URLSearchParams({ page, per_page: perPage })
@@ -31,18 +31,13 @@ export function deleteDocumentRemoveOnly(id) {
}
export function classifyDocument(id, topics = null) {
return request(`/api/documents/${id}/classify`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(topics ? { topics } : {}),
})
return jsonRequest(`/api/documents/${id}/classify`, 'POST', topics ? { topics } : {})
}
export function getUploadUrl(filename, contentType) {
return request('/api/documents/upload-url', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ filename, content_type: contentType }),
return jsonRequest('/api/documents/upload-url', 'POST', {
filename,
content_type: contentType,
})
}