Special charaacter bug solved

This commit is contained in:
Eudes Inácio
2023-12-01 12:19:20 +01:00
parent c978447eb1
commit d3c551dfbb
5 changed files with 62 additions and 10 deletions
+14 -3
View File
@@ -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);
})
);