2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
import { Injectable } from '@angular/core';
|
2023-08-01 13:29:27 +02:00
|
|
|
import { Router } from '@angular/router';
|
2019-06-03 15:20:36 +02:00
|
|
|
import {Observable} from 'rxjs';
|
2020-09-18 09:57:42 +02:00
|
|
|
import {properties} from "../../../../environments/environment";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2020-08-12 17:16:09 +02:00
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
}) // do not forget to register this class as a provider
|
2023-08-01 13:29:27 +02:00
|
|
|
export class PreviousRouteRecorder {
|
2017-12-19 13:53:46 +01:00
|
|
|
constructor(private router: Router) {
|
|
|
|
}
|
|
|
|
canDeactivate(component: any): Observable<boolean> | boolean {
|
|
|
|
if (typeof localStorage !== 'undefined') {
|
2020-11-05 17:47:23 +01:00
|
|
|
// console.log("In PreviousRouteRecorder : " + properties.domain +properties.baseLink + this.router.url );
|
2020-09-18 12:10:18 +02:00
|
|
|
localStorage.setItem('previousRoute', properties.domain + properties.baseLink + this.router.url);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|