fixes cookie_prefix for development setups

This commit is contained in:
jonaswinkler 2020-12-17 21:54:05 +01:00
parent 48796e6961
commit 35dcc54dc8

View File

@ -17,8 +17,10 @@ export class CsrfInterceptor implements HttpInterceptor {
} }
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> { intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
let prefix = ""
let prefix = this.meta.getTag('name=cookie_prefix').content if (this.meta.getTag('name=cookie_prefix')) {
prefix = this.meta.getTag('name=cookie_prefix').content
}
let csrfToken = this.cookieService.get(`${prefix?prefix:''}csrftoken`) let csrfToken = this.cookieService.get(`${prefix?prefix:''}csrftoken`)
if (csrfToken) { if (csrfToken) {
request = request.clone({ request = request.clone({