mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Special charaacter bug solved
This commit is contained in:
@@ -13,6 +13,7 @@ import { Observable, throwError, BehaviorSubject, of } from "rxjs";
|
||||
import { catchError, filter, take, switchMap, tap } from "rxjs/operators";
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { environment } from "src/environments/environment";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
@Injectable()
|
||||
export class TokenInterceptor implements HttpInterceptor {
|
||||
@@ -21,7 +22,7 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
null
|
||||
);
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient, private router: Router,) { }
|
||||
|
||||
|
||||
intercept(
|
||||
@@ -74,10 +75,10 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//this method refresh token is declared here temporary beacouse a circular error
|
||||
refreshToken() {
|
||||
|
||||
|
||||
return this.http
|
||||
.put<any>(environment.apiURL + "UserAuthentication/RefreshToken", {
|
||||
refreshToken: SessionStore.user.RefreshToken,
|
||||
@@ -92,6 +93,16 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
catchError((error) => {
|
||||
SessionStore.user.Authorization = "";
|
||||
SessionStore.user.RefreshToken = "";
|
||||
SessionStore.setInativity(false)
|
||||
/* SessionStore.setUrlBeforeInactivity(this.router.url); */
|
||||
|
||||
if (environment.production) {
|
||||
window.location.pathname = '/auth'
|
||||
} else {
|
||||
/* const pathBeforeGoOut = window.location.pathname */
|
||||
this.router.navigateByUrl('/auth', { replaceUrl: true });
|
||||
|
||||
}
|
||||
return of(false);
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user