Pārlūkot izejas kodu

Update index.js (#2864)

* Update index.js

This PR added companion cookies rule to every provider except Box.
https://github.com/transloadit/uppy/pull/2618

(Not sure if there's a reason Box was left out)

* Update docs for the change
Jace Zhu 4 gadi atpakaļ
vecāks
revīzija
ab5cb3e1e9
2 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 2 0
      packages/@uppy/box/src/index.js
  2. 4 0
      website/src/docs/box.md

+ 2 - 0
packages/@uppy/box/src/index.js

@@ -26,6 +26,8 @@ module.exports = class Box extends Plugin {
     this.provider = new Provider(uppy, {
       companionUrl: this.opts.companionUrl,
       companionHeaders: this.opts.companionHeaders || this.opts.serverHeaders,
+      companionKeysParams: this.opts.companionKeysParams,
+      companionCookiesRule: this.opts.companionCookiesRule,
       provider: 'box',
       pluginId: this.id,
     })

+ 4 - 0
website/src/docs/box.md

@@ -118,6 +118,10 @@ This value can be a `String`, a `Regex` pattern, or an `Array` of both.
 
 This is useful when you have your [Companion](/docs/companion) running on multiple hosts. Otherwise, the default value should do just fine.
 
+### `companionCookiesRule: 'same-origin'`
+
+This option correlates to the [RequestCredentials value](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials), which tells the plugin whether or not to send cookies to [Companion](/docs/companion).
+
 ### `locale: {}`
 
 Localize text that is shown to the user.