diff --git a/public/images/migration/trello.png b/public/images/migration/trello.png new file mode 100644 index 000000000..02cfa1140 Binary files /dev/null and b/public/images/migration/trello.png differ diff --git a/src/components/migrator/migration.vue b/src/components/migrator/migration.vue index ac3998114..84c36c5a3 100644 --- a/src/components/migrator/migration.vue +++ b/src/components/migrator/migration.vue @@ -64,7 +64,7 @@ export default { isMigrating: false, lastMigrationDate: null, message: '', - wunderlistCode: '', + migratorAuthCode: '', } }, props: { @@ -82,13 +82,25 @@ export default { this.getAuthUrl() this.message = '' - if (typeof this.$route.query.code !== 'undefined') { - this.wunderlistCode = this.$route.query.code + if (typeof this.$route.query.code !== 'undefined' || location.hash.startsWith('#token=')) { + if (location.hash.startsWith('#token=')) { + this.migratorAuthCode = location.hash.substring(7) + console.log(location.hash.substring(7)) + } else { + this.migratorAuthCode = this.$route.query.code + } this.migrationService.getStatus() .then(r => { if (r.time) { - this.lastMigrationDate = new Date(r.time) - return + if (typeof r.time === 'string' && r.time.startsWith('0001-')) { + this.lastMigrationDate = null + } else { + this.lastMigrationDate = new Date(r.time) + } + + if (this.lastMigrationDate) { + return + } } this.migrate() }) @@ -109,10 +121,12 @@ export default { }, migrate() { this.isMigrating = true - this.lastMigrationDate = 0 - this.migrationService.migrate({code: this.wunderlistCode}) + this.lastMigrationDate = null + this.message = '' + this.migrationService.migrate({code: this.migratorAuthCode}) .then(r => { this.message = r.message + this.$store.dispatch('namespaces/loadNamespaces') }) .catch(e => { this.error(e, this) diff --git a/src/views/migrator/MigrateService.vue b/src/views/migrator/MigrateService.vue index f09d8a214..e126485cc 100644 --- a/src/views/migrator/MigrateService.vue +++ b/src/views/migrator/MigrateService.vue @@ -33,6 +33,10 @@ export default { this.name = 'Todoist' this.identifier = 'todoist' break + case 'trello': + this.name = 'Trello' + this.identifier = 'trello' + break default: router.push({name: '404'}) }