Skip to content

Commit 6cf3c74

Browse files
committed
fix: allow attachFiles to be an async function. Might allow to predownload files or use in conjhunction with adapter.getKeyAsDataURL()
1 parent 918cf92 commit 6cf3c74

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export default class UploadPlugin extends AdminForthPlugin {
365365
return { error: `Record with id ${recordId} not found` };
366366
}
367367

368-
attachmentFiles = this.options.generation.attachFiles({ record, adminUser });
368+
attachmentFiles = await this.options.generation.attachFiles({ record, adminUser });
369369
// if files is not array, make it array
370370
if (!Array.isArray(attachmentFiles)) {
371371
attachmentFiles = [attachmentFiles];

types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export type PluginOptions = {
131131
attachFiles?: ({ record, adminUser }: {
132132
record: any,
133133
adminUser: AdminUser,
134-
}) => string[],
134+
}) => string[] | Promise<string[]>,
135135

136136

137137
/**

0 commit comments

Comments
 (0)