diff --git a/src/plugins/GoogleDrive.js b/src/plugins/GoogleDrive.js index a0668b57e..9d1dbffb8 100644 --- a/src/plugins/GoogleDrive.js +++ b/src/plugins/GoogleDrive.js @@ -1,5 +1,7 @@ // import Utils from '../core/Utils' import Plugin from './Plugin' +// temporarily using superagent +import request from 'superagent' export default class Drive extends Plugin { constructor (core, opts) { @@ -8,9 +10,13 @@ export default class Drive extends Plugin { this.authenticate = this.authenticate.bind(this) this.connect = this.connect.bind(this) this.render = this.render.bind(this) + this.renderAuthentication = this.renderAuthentication.bind(this) + this.checkAuthentication = this.checkAuthentication.bind(this) this.files = [] this.currentDir = '/' + this.checkAuthentication() + this.isAuthenticated = false } @@ -23,6 +29,16 @@ export default class Drive extends Plugin { } } + checkAuthentication () { + request.get('http://localhost:3002/drive/auth/authorize') + .set('Content-Type', 'application/json') + .end((err, res) => { + if (err) { return new Error(err) } + this.isAuthenticated = res.body.isAuthenticated + this.authUrl = res.body.authUrl + }) + } + authenticate () { } @@ -39,7 +55,7 @@ export default class Drive extends Plugin { } renderAuthentication () { - return `