mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-25 19:23:55 +00:00
transloadit: Add global metadata as fields
This commit is contained in:
parent
1d87d11a06
commit
98cca8f98d
1 changed files with 7 additions and 9 deletions
|
|
@ -3,14 +3,6 @@ const Plugin = require('../../core/Plugin')
|
|||
const Client = require('./Client')
|
||||
const StatusSocket = require('./Socket')
|
||||
|
||||
function defaultGetAssemblyOptions (file, options) {
|
||||
return {
|
||||
params: options.params,
|
||||
signature: options.signature,
|
||||
fields: options.fields
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload files to Transloadit using Tus.
|
||||
*/
|
||||
|
|
@ -37,7 +29,13 @@ module.exports = class Transloadit extends Plugin {
|
|||
signature: null,
|
||||
params: null,
|
||||
fields: {},
|
||||
getAssemblyOptions: defaultGetAssemblyOptions,
|
||||
getAssemblyOptions: (file, options) => ({
|
||||
params: options.params,
|
||||
signature: options.signature,
|
||||
// Include global metadata as fields by default.
|
||||
// Works great together with the Form plugin :)
|
||||
fields: Object.assign({}, this.uppy.getState().meta, options.fields)
|
||||
}),
|
||||
locale: defaultLocale
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue