commit 7d693b8627c745443b6ace3a4879acf8284d6b42
parent d6cffc55b06ef36cc59a110f37e1f685202e8569
Author: MTRNord <mtrnord1@gmail.com>
Date: Sat, 31 Mar 2018 22:03:02 +0200
Navigate to front page after callback
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/app/callback/twitter/twitter.component.ts b/src/app/callback/twitter/twitter.component.ts
@@ -1,5 +1,5 @@
import {Component, Inject, OnInit} from '@angular/core';
-import {ActivatedRoute} from '@angular/router';
+import {ActivatedRoute, Router} from '@angular/router';
import {ToastrService} from 'ngx-toastr';
import {Observable} from 'rxjs/Observable';
@@ -24,7 +24,7 @@ export class TwitterComponent implements OnInit {
oauth_token: string;
oauth_verifier: string;
- constructor(private apiService: ApiService, private toastr: ToastrService, private route: ActivatedRoute, @Inject(DOCUMENT) private document, private http: HttpClient) {
+ constructor(private apiService: ApiService, private toastr: ToastrService, private route: ActivatedRoute, @Inject(DOCUMENT) private document, private http: HttpClient, private router: Router) {
this.url = document.location.protocol + '//' + document.location.hostname + '/api';
}
@@ -55,6 +55,9 @@ export class TwitterComponent implements OnInit {
.subscribe(
data => {
this.apiService.authToken = data.headers.get('authorization');
+
+ // TODO redirect to the Profile instead of home page
+ this.router.navigate(['/']);
},
err => {
this.toastr.error(err['error'], 'Error connecting API', {
@@ -63,7 +66,7 @@ export class TwitterComponent implements OnInit {
});
throw err;
},
- () => console.log('done loading Yesterday')
+ () => console.log('done making callback')
);
});
}