Fix TS errors

This commit is contained in:
Andrew Kingston 2024-12-10 14:53:30 +00:00
parent 6463b1c551
commit 8efb2d701c
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -27,7 +27,7 @@ export interface AttachmentEndpoints {
bucket: string, bucket: string,
key: string, key: string,
data: any data: any
) => Promise<{ publicUrl: string }> ) => Promise<{ publicUrl: string | undefined }>
} }
export const buildAttachmentEndpoints = ( export const buildAttachmentEndpoints = (
@ -92,6 +92,9 @@ export const buildAttachmentEndpoints = (
bucket, bucket,
key key
) )
if (!signedUrl) {
return { publicUrl: undefined }
}
await API.put({ await API.put({
url: signedUrl, url: signedUrl,
body: data, body: data,
@ -100,6 +103,7 @@ export const buildAttachmentEndpoints = (
}) })
return { publicUrl } return { publicUrl }
}, },
/** /**
* Download an attachment from a row given its column name. * Download an attachment from a row given its column name.
* @param datasourceId the ID of the datasource to download from * @param datasourceId the ID of the datasource to download from