Skip to content

Commit

Permalink
refactor(login): refactor refresh method + clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
flaurens committed Jan 27, 2021
1 parent 27bc05c commit 34e4acf
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions src/app/main/login/login.component.ts
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { SessionService } from '@dasch-swiss/dsp-ui';
Expand All @@ -9,7 +9,7 @@ import { ComponentCommunicationEventService, EmitEvent, Events } from 'src/app/m
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
export class LoginComponent {

returnUrl: string;

Expand All @@ -22,27 +22,17 @@ export class LoginComponent implements OnInit {
// set the page title
this._titleService.setTitle('Login');

this.returnUrl = this._route.snapshot.queryParams['returnUrl'] || '/';
// this.returnUrl = this._route.snapshot.queryParams['returnUrl'] || '/';
}

ngOnInit() {
}
refresh(status: boolean) {

refresh() {
// check if a session is active
if (this._session.getSession()) {
// go to the dashboard:
if (status && this._session.getSession()) {
this._router.navigate(['dashboard']);
}
}

// TO REPLACE THE METHOD ABOVE ONCE WE WILL USE DSP-APP AS A RESEARCH PLATFORM AGAIN
/* refresh(status: boolean) {
// go to previous route:
if (status) {
this._router.navigate([this.returnUrl]);
// go to the previous route: this._router.navigate([this.returnUrl]);
this._componentCommsService.emit(new EmitEvent(Events.LoginSuccess, true));
}
} */
}

}

0 comments on commit 34e4acf

Please sign in to comment.