|
@@ -1,13 +1,13 @@
|
|
|
'use strict'
|
|
|
|
|
|
-const RequestClient = require('./RequestClient')
|
|
|
-const tokenStorage = require('./tokenStorage')
|
|
|
+import RequestClient from './RequestClient.js'
|
|
|
+import tokenStorage from './tokenStorage.js'
|
|
|
|
|
|
const getName = (id) => {
|
|
|
return id.split('-').map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(' ')
|
|
|
}
|
|
|
|
|
|
-module.exports = class Provider extends RequestClient {
|
|
|
+export default class Provider extends RequestClient {
|
|
|
constructor (uppy, opts) {
|
|
|
super(uppy, opts)
|
|
|
this.provider = opts.provider
|
|
@@ -37,7 +37,7 @@ module.exports = class Provider extends RequestClient {
|
|
|
}
|
|
|
|
|
|
onReceiveResponse (response) {
|
|
|
- response = super.onReceiveResponse(response)
|
|
|
+ response = super.onReceiveResponse(response) // eslint-disable-line no-param-reassign
|
|
|
const plugin = this.uppy.getPlugin(this.pluginId)
|
|
|
const oldAuthenticated = plugin.getPluginState().authenticated
|
|
|
const authenticated = oldAuthenticated ? response.status !== 401 : response.status < 400
|
|
@@ -106,6 +106,7 @@ module.exports = class Provider extends RequestClient {
|
|
|
}
|
|
|
|
|
|
static initPlugin (plugin, opts, defaultOpts) {
|
|
|
+ /* eslint-disable no-param-reassign */
|
|
|
plugin.type = 'acquirer'
|
|
|
plugin.files = []
|
|
|
if (defaultOpts) {
|
|
@@ -131,5 +132,6 @@ module.exports = class Provider extends RequestClient {
|
|
|
}
|
|
|
|
|
|
plugin.storage = plugin.opts.storage || tokenStorage
|
|
|
+ /* eslint-enable no-param-reassign */
|
|
|
}
|
|
|
}
|