vboxes fix

This commit is contained in:
2026-03-19 14:28:09 +01:00
parent b7f7c1f7c0
commit 06dfbfcbc4
30 changed files with 4405 additions and 166 deletions
+23
View File
@@ -12,10 +12,33 @@ export interface SendJobFilters {
status?: string
}
/** Payload esteso per l'invio multipart (include body_html) */
export interface SendPecMultipartRequest extends SendPecRequest {
body_html?: string
}
export const sendApi = {
/** Invio PEC semplice (JSON, senza allegati) retrocompatibile */
send: (data: SendPecRequest) =>
apiClient.post<SendJobResponse>('/send', data).then((r) => r.data),
/**
* Invio PEC con allegati tramite multipart/form-data.
*
* Il campo `data` viene serializzato come JSON string;
* i file vengono appesi come `attachments[]`.
*/
sendMultipart: (data: SendPecMultipartRequest, files: File[] = []) => {
const formData = new FormData()
formData.append('data', JSON.stringify(data))
files.forEach((file) => formData.append('attachments', file))
return apiClient
.post<SendJobResponse>('/send/multipart', formData, {
headers: { 'Content-Type': 'multipart/form-data' },
})
.then((r) => r.data)
},
listJobs: (filters: SendJobFilters = {}) =>
apiClient.get<SendJobListResponse>('/send/jobs', { params: filters }).then((r) => r.data),