mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
feat: add auth support (default and paia)
This commit is contained in:
committed by
Jovan Krunić
parent
046a95ba1d
commit
b5f239ea4e
@@ -0,0 +1,34 @@
|
||||
import {Component, OnInit, OnDestroy} from '@angular/core';
|
||||
import {NavController} from '@ionic/angular';
|
||||
import {Router} from '@angular/router';
|
||||
import {IAuthAction} from 'ionic-appauth';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {DefaultAuthService} from '../../default-auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'auth-callback',
|
||||
templateUrl: './auth-callback-page.component.html',
|
||||
styleUrls: ['./auth-callback-page.component.scss'],
|
||||
})
|
||||
export class AuthCallbackPageComponent implements OnInit, OnDestroy {
|
||||
sub: Subscription;
|
||||
|
||||
constructor(
|
||||
private auth: DefaultAuthService,
|
||||
private navCtrl: NavController,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.auth.events$.subscribe(action => this.postCallback(action));
|
||||
this.auth.authorizationCallback(window.location.origin + this.router.url);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
async postCallback(_action: IAuthAction) {
|
||||
await this.navCtrl.navigateRoot('profile');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user