Refactor backend and frontend cleanup paths
This commit is contained in:
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user