feat(documents) : bouton reload explorateur + liaison d'un fichier du partage SMB à un ticket
This commit is contained in:
@@ -5,7 +5,8 @@ export type TaskDocument = {
|
||||
id: number
|
||||
task: string
|
||||
originalName: string
|
||||
fileName: string
|
||||
fileName?: string | null
|
||||
sharePath?: string | null
|
||||
mimeType: string
|
||||
size: number
|
||||
createdAt: string
|
||||
|
||||
@@ -31,6 +31,15 @@ export function useTaskDocumentService() {
|
||||
return uploadWithRelation('task', `/api/tasks/${taskId}`, file)
|
||||
}
|
||||
|
||||
async function linkShare(taskId: number, sharePath: string): Promise<TaskDocument> {
|
||||
return $fetch<TaskDocument>(`${baseURL}/task_documents`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ task: `/api/tasks/${taskId}`, sharePath }),
|
||||
credentials: 'include',
|
||||
})
|
||||
}
|
||||
|
||||
async function remove(id: number): Promise<void> {
|
||||
await api.delete(`/task_documents/${id}`, {}, {
|
||||
toastSuccessKey: 'taskDocuments.deleted',
|
||||
@@ -48,5 +57,5 @@ export function useTaskDocumentService() {
|
||||
})
|
||||
}
|
||||
|
||||
return { getByTask, upload, remove, getDownloadUrl, getContent }
|
||||
return { getByTask, upload, linkShare, remove, getDownloadUrl, getContent }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user