You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-12-01 22:52:06 +02:00
Fixing tests
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {AuthenticationService} from '../authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class CSRFInterceptor implements HttpInterceptor {
|
||||
constructor(private authenticationService: AuthenticationService) {
|
||||
}
|
||||
|
||||
intercept(
|
||||
request: HttpRequest<any>,
|
||||
next: HttpHandler
|
||||
): Observable<HttpEvent<any>> {
|
||||
// add authorization header with jwt token if available
|
||||
const currentUser = this.authenticationService.user.value;
|
||||
if (currentUser && currentUser.csrfToken) {
|
||||
request = request.clone({
|
||||
setHeaders: {
|
||||
'CSRF-Token': `${currentUser.csrfToken}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
return next.handle(request);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import { enableProdMode, Injectable, importProvidersFrom } from '@angular/core';
|
||||
import { environment } from './environments/environment';
|
||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi, HttpClient } from '@angular/common/http';
|
||||
import { CSRFInterceptor } from './app/model/network/helper/csrf.interceptor';
|
||||
import { ErrorInterceptor } from './app/model/network/helper/error.interceptor';
|
||||
import { UrlSerializer, DefaultUrlSerializer, UrlTree } from '@angular/router';
|
||||
import { HAMMER_GESTURE_CONFIG, HammerGestureConfig, BrowserModule, HammerModule, bootstrapApplication } from '@angular/platform-browser';
|
||||
@@ -125,7 +124,6 @@ bootstrapApplication(AppComponent, {
|
||||
ionBrowsersOutline, ionUnlinkOutline, ionSquareOutline, ionGridOutline,
|
||||
ionAppsOutline, ionOpenOutline, ionRefresh, ionExtensionPuzzleOutline, ionList
|
||||
}), ClipboardModule, TooltipModule.forRoot(), ToastrModule.forRoot(), ModalModule.forRoot(), CollapseModule.forRoot(), PopoverModule.forRoot(), BsDropdownModule.forRoot(), BsDatepickerModule.forRoot(), TimepickerModule.forRoot(), LoadingBarModule, LeafletModule, LeafletMarkerClusterModule, MarkdownModule.forRoot({ loader: HttpClient })),
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: CSRFInterceptor, multi: true },
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
|
||||
{ provide: UrlSerializer, useClass: CustomUrlSerializer },
|
||||
{ provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig },
|
||||
|
||||
Reference in New Issue
Block a user