Forráskód Böngészése

Correct `upload-success` params in docs

Artur Paikin 7 éve
szülő
commit
f0e2432601
2 módosított fájl, 11 hozzáadás és 7 törlés
  1. 2 2
      website/src/docs/uppy.md
  2. 9 5
      website/src/docs/xhrupload.md

+ 2 - 2
website/src/docs/uppy.md

@@ -342,12 +342,12 @@ uppy.on('upload-progress', (data) => {
 Fired when single upload is complete.
 Fired when single upload is complete.
 
 
 ``` javascript
 ``` javascript
-uppy.on('upload-success', (fileId, url) => {
+uppy.on('upload-success', (fileId, resp, uploadURL) => {
   console.log(url)
   console.log(url)
   var img = new Image()
   var img = new Image()
   img.width = 300
   img.width = 300
   img.alt = fileId
   img.alt = fileId
-  img.src = url
+  img.src = uploadURL
   document.body.appendChild(img)
   document.body.appendChild(img)
 })
 })
 ```
 ```

+ 9 - 5
website/src/docs/xhrupload.md

@@ -57,7 +57,14 @@ headers: {
 
 
 ### `getResponseData(xhr)`
 ### `getResponseData(xhr)`
 
 
-When an upload has completed, Uppy will extract response data from the upload endpoint and send it back in the `upload-success` event.
+When an upload has completed, Uppy will extract response data from the upload endpoint and send it back in the `upload-success` event:
+
+```js
+uppy.on('upload-success', (fileId, resp, uploadURL) => {
+  // do something with resp
+})
+```
+
 By default, Uppy assumes the endpoint will return JSON. So, if `POST /upload` responds with:
 By default, Uppy assumes the endpoint will return JSON. So, if `POST /upload` responds with:
 
 
 ```json
 ```json
@@ -67,10 +74,7 @@ By default, Uppy assumes the endpoint will return JSON. So, if `POST /upload` re
 }
 }
 ```
 ```
 
 
-That object will be emitted in the `upload-success` event.
-
-Not all endpoints respond with JSON. Providing a `getResponseData` function overrides this behavior.
-The `xhr` parameter is the `XMLHttpRequest` instance used to upload the file.
+That object will be emitted in the `upload-success` event. Not all endpoints respond with JSON. Providing a `getResponseData` function overrides this behavior. The `xhr` parameter is the `XMLHttpRequest` instance used to upload the file.
 
 
 For example, an endpoint that responds with an XML document:
 For example, an endpoint that responds with an XML document: