Browse Source

Add a credentials option to the asset manager config to allow overriding the default 'include' option

pull/1430/head
Tom Robertson 8 years ago
parent
commit
f31b3ccc49
  1. 3
      docs/modules/Assets.md
  2. 3
      src/asset_manager/config/config.js
  3. 2
      src/asset_manager/view/FileUploader.js

3
docs/modules/Assets.md

@ -63,6 +63,9 @@ Below the list of currently available options
// Custom parameters to pass with the upload request, eg. csrf token
params: {},
// The credentials setting for the upload request, eg. 'include', 'omit'
credentials: 'include',
// If true, tries to add automatically uploaded assets.
// To make it work the server should respond with a JSON containing assets
// in a data key, eg:

3
src/asset_manager/config/config.js

@ -29,6 +29,9 @@ module.exports = {
// Custom parameters to pass with the upload request, eg. csrf token
params: {},
// The credentials setting for the upload request, eg. 'include', 'omit'
credentials: 'include',
// If true, tries to add automatically uploaded assets.
// To make it work the server should respond with a JSON containing assets
// in a data key, eg:

2
src/asset_manager/view/FileUploader.js

@ -122,7 +122,7 @@ module.exports = Backbone.View.extend(
this.onUploadStart();
return fetch(url, {
method: 'post',
credentials: 'include',
credentials: config.credentials || 'include',
headers,
body
})

Loading…
Cancel
Save