2022-01-20 10:40:53 +01:00
|
|
|
export const buildAttachmentEndpoints = API => ({
|
|
|
|
/**
|
|
|
|
* Uploads an attachment to the server.
|
2022-01-21 10:10:59 +01:00
|
|
|
* @param data the attachment to upload
|
|
|
|
* @param tableId the table ID to upload to
|
2022-01-20 10:40:53 +01:00
|
|
|
*/
|
|
|
|
uploadAttachment: async ({ data, tableId }) => {
|
|
|
|
return await API.post({
|
|
|
|
url: `/api/attachments/${tableId}/upload`,
|
|
|
|
body: data,
|
|
|
|
json: false,
|
|
|
|
})
|
|
|
|
},
|
2022-01-21 10:10:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Uploads an attachment to the server as a builder user from the builder.
|
|
|
|
* @param data the data to upload
|
|
|
|
*/
|
|
|
|
uploadBuilderAttachment: async data => {
|
|
|
|
return await API.post({
|
|
|
|
url: "/api/attachments/process",
|
|
|
|
body: data,
|
|
|
|
json: false,
|
|
|
|
})
|
|
|
|
},
|
2022-01-20 10:40:53 +01:00
|
|
|
})
|