clean create event page, stop video, event list box

This commit is contained in:
Peter Maquiran
2023-12-06 12:07:22 +01:00
26 changed files with 351 additions and 79 deletions
+17 -6
View File
@@ -8,11 +8,11 @@ import {
HTTP_INTERCEPTORS,
HttpClient,
} from "@angular/common/http";
import { AuthService } from '../services/auth.service';
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 +21,7 @@ export class TokenInterceptor implements HttpInterceptor {
null
);
constructor(private http: HttpClient) { }
constructor(private http: HttpClient, private router: Router,) { }
intercept(
@@ -74,10 +74,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,
@@ -90,7 +90,18 @@ export class TokenInterceptor implements HttpInterceptor {
}),
catchError((error) => {
/* this.logoutUser(); */
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);
})
);
@@ -102,4 +113,4 @@ export const tokenInterceptor = {
provide: HTTP_INTERCEPTORS,
useClass: TokenInterceptor,
multi: true
};
};