|
@@ -31,9 +31,10 @@ Instead of adding a UI plugin to an Uppy instance with `.use()`, the Uppy instan
|
|
All other props are passed as options to the plugin.
|
|
All other props are passed as options to the plugin.
|
|
|
|
|
|
```js
|
|
```js
|
|
-const Uppy = require('@uppy/core')
|
|
|
|
-const Tus = require('@uppy/tus')
|
|
|
|
-const { DragDrop } = require('@uppy/react')
|
|
|
|
|
|
+import React from 'react'
|
|
|
|
+import Uppy from '@uppy/core'
|
|
|
|
+import Tus from '@uppy/tus'
|
|
|
|
+import { DragDrop } from '@uppy/react'
|
|
|
|
|
|
const uppy = Uppy({
|
|
const uppy = Uppy({
|
|
meta: { type: 'avatar' },
|
|
meta: { type: 'avatar' },
|
|
@@ -46,7 +47,7 @@ uppy.use(Tus, { endpoint: '/upload' })
|
|
uppy.on('complete', (result) => {
|
|
uppy.on('complete', (result) => {
|
|
const url = result.successful[0].uploadURL
|
|
const url = result.successful[0].uploadURL
|
|
store.dispatch({
|
|
store.dispatch({
|
|
- type: SET_USER_AVATAR_URL,
|
|
|
|
|
|
+ type: 'SET_USER_AVATAR_URL',
|
|
payload: { url: url }
|
|
payload: { url: url }
|
|
})
|
|
})
|
|
})
|
|
})
|