added redirection to url root

This commit is contained in:
Nicolas Constant 2019-10-31 19:58:09 -04:00
parent a23db9b30e
commit bbfb4bc026
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 12 additions and 1 deletions

View File

@ -101,7 +101,7 @@ export class AddNewAccountComponent implements OnInit {
if (instanceApps.length !== 0) { if (instanceApps.length !== 0) {
return Promise.resolve(instanceApps[0].app); return Promise.resolve(instanceApps[0].app);
} else { } else {
const redirect_uri = this.getLocalHostname() + '/register'; const redirect_uri = this.getLocalHostname();
return this.authService.createNewApplication(instance, 'Sengi', redirect_uri, 'read write follow', 'https://nicolasconstant.github.io/sengi/') return this.authService.createNewApplication(instance, 'Sengi', redirect_uri, 'read write follow', 'https://nicolasconstant.github.io/sengi/')
.then((appData: AppData) => { .then((appData: AppData) => {
return this.saveNewApp(instance, appData) return this.saveNewApp(instance, appData)

View File

@ -1,4 +1,5 @@
import { Component, OnInit, OnDestroy, QueryList, ViewChildren, ElementRef } from "@angular/core"; import { Component, OnInit, OnDestroy, QueryList, ViewChildren, ElementRef } from "@angular/core";
import { ActivatedRoute, Router } from '@angular/router';
import { Observable, Subscription } from "rxjs"; import { Observable, Subscription } from "rxjs";
import { Select } from "@ngxs/store"; import { Select } from "@ngxs/store";
import scrollIntoView from "smooth-scroll-into-view-if-needed"; import scrollIntoView from "smooth-scroll-into-view-if-needed";
@ -19,10 +20,20 @@ export class StreamsMainDisplayComponent implements OnInit, OnDestroy {
private columnSelectedSub: Subscription; private columnSelectedSub: Subscription;
constructor( constructor(
private readonly router: Router,
private readonly activatedRoute: ActivatedRoute,
private readonly navigationService: NavigationService) { private readonly navigationService: NavigationService) {
} }
ngOnInit() { ngOnInit() {
this.activatedRoute.queryParams.subscribe(params => {
const code = params['code'];
if (code) {
this.router.navigate(['/register'], { queryParams: { code: code} });
return;
}
});
this.columnSelectedSub = this.navigationService.columnSelectedSubject.subscribe((columnIndex: number) => { this.columnSelectedSub = this.navigationService.columnSelectedSubject.subscribe((columnIndex: number) => {
this.focusOnColumn(columnIndex); this.focusOnColumn(columnIndex);
}); });