Browse Source

Fixes to custom provider example.

Renée Kooi 6 years ago
parent
commit
8b7340a8bc

+ 7 - 3
examples/custom-provider/client/MyCustomProvider.js

@@ -8,6 +8,8 @@ module.exports = class MyCustomProvider extends Plugin {
     super(uppy, opts)
     this.type = 'acquirer'
     this.id = this.opts.id || 'MyCustomProvider'
+    Provider.initPlugin(this, opts)
+
     this.title = 'MyCustomProvider'
     this.icon = () => (
       <img src="https://uppy.io/images/logos/uppy-dog-head-arrow.svg" width="23" />
@@ -68,9 +70,7 @@ module.exports = class MyCustomProvider extends Plugin {
   }
 
   getItemIcon (item) {
-    return () => (
-      <img src="https://uppy.io/images/logos/uppy-dog-head-arrow.svg" />
-    )
+    return 'https://uppy.io/images/logos/uppy-dog-head-arrow.svg'
   }
 
   getItemSubList (item) {
@@ -102,6 +102,10 @@ module.exports = class MyCustomProvider extends Plugin {
     return 'https://uppy.io/images/logos/uppy-dog-head-arrow.svg'
   }
 
+  getUsername () {
+    return 'Cool Dog'
+  }
+
   render (state) {
     return this.view.render(state)
   }

+ 1 - 1
examples/custom-provider/package.json

@@ -2,7 +2,7 @@
   "private": true,
   "name": "custom-provider-example",
   "scripts": {
-    "copy": "cp ../../dist/uppy.min.css .",
+    "copy": "cp ../../packages/uppy/dist/uppy.min.css .",
     "start:client": "budo client/main.js:bundle.js -- -t babelify -g aliasify",
     "start:server": "node server/index.js",
     "start": "npm-run-all --serial copy --parallel start:*"