mirror of
https://github.com/idrainformatica/PecFlow.git
synced 2026-06-16 12:45:42 +02:00
vboxes fix
This commit is contained in:
@@ -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),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user