diff --git a/src/plugins/GoogleDrive/Browser.js b/src/plugins/GoogleDrive/Browser.js index 70cf8e6f4..f46b9434e 100644 --- a/src/plugins/GoogleDrive/Browser.js +++ b/src/plugins/GoogleDrive/Browser.js @@ -1,5 +1,4 @@ import html from '../../core/html' -import Breadcrumbs from './Breadcrumbs' import Sidebar from './Sidebar' import Table from './Table' @@ -14,17 +13,9 @@ export default (props, bus) => { return html`
-
- -
-
+
${Sidebar({ getRootDirectory: () => props.getNextFolder('root', 'Google Drive'), logout: props.logout, @@ -32,7 +23,7 @@ export default (props, bus) => { filterInput: props.filterInput })}
-
+
${Table({ folders: filteredFolders, diff --git a/src/plugins/GoogleDrive/index.js b/src/plugins/GoogleDrive/index.js index a2c1233c8..207ffbc61 100644 --- a/src/plugins/GoogleDrive/index.js +++ b/src/plugins/GoogleDrive/index.js @@ -38,6 +38,8 @@ export default class Google extends Plugin { this.handleRowClick = this.handleRowClick.bind(this) this.logout = this.logout.bind(this) this.handleDemoAuth = this.handleDemoAuth.bind(this) + this.sortByTitle = this.sortByTitle.bind(this) + this.sortByDate = this.sortByDate.bind(this) // Visual this.render = this.render.bind(this) @@ -73,6 +75,9 @@ export default class Google extends Plugin { .then((authenticated) => { this.updateState({authenticated}) + console.log('are we authenticated?') + console.log(authenticated) + if (authenticated) { return this.getFolder('root') } @@ -110,15 +115,11 @@ export default class Google extends Plugin { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' - }, - body: { - demo: this.opts.demo } }) .then((res) => { - if (res.status >= 200 && res.status <= 300) { - return res.json() - } else { + console.log(res.status) + if (res.status < 200 || res.status > 300) { this.updateState({ authenticated: false, error: true @@ -127,6 +128,8 @@ export default class Google extends Plugin { error.response = res throw error } + + return res.json() }) .then((data) => data.isAuthenticated) .catch((err) => err) @@ -275,7 +278,7 @@ export default class Google extends Plugin { } sortByTitle () { - const state = this.core.getState().googleDrive + const state = Object.assign({}, this.core.getState().googleDrive) const {files, folders, sorting} = state let sortedFiles = files.sort((fileA, fileB) => { @@ -300,7 +303,7 @@ export default class Google extends Plugin { } sortByDate () { - const state = this.core.getState().googleDrive + const state = Object.assign({}, this.core.getState().googleDrive) const {files, folders, sorting} = state let sortedFiles = files.sort((fileA, fileB) => { @@ -366,6 +369,8 @@ export default class Google extends Plugin { filterItems: this.filterItems, filterQuery: this.filterQuery, handleRowClick: this.handleRowClick, + sortByTitle: this.sortByTitle, + sortByDate: this.sortByDate, logout: this.logout, demo: this.opts.demo })