[angular-16-irish-monitor | DONE | CHANGED] cookie banner: parameterize cookie name

This commit is contained in:
argirok 2023-12-06 15:13:59 +02:00
parent 736546c0eb
commit 8c5c4923d3
2 changed files with 7 additions and 7 deletions

View File

@ -66,7 +66,7 @@ export type CookieLawTarget = '_blank' | '_self';
})
export class CookieLawComponent implements OnInit {
public cookieLawSeen: boolean;
@Input() cookieName = "cookieLawSeen";
@Input('learnMore')
get learnMore() { return this._learnMore; }
set learnMore(value: string) {
@ -109,7 +109,7 @@ export class CookieLawComponent implements OnInit {
this.isSeenEvt = new EventEmitter<boolean>();
this.animation = 'topIn';
this._position = 'bottom';
this.cookieLawSeen = this._service.seen();
this.cookieLawSeen = this._service.seen(this.cookieName);
}
ngOnInit(): void {
@ -142,7 +142,7 @@ export class CookieLawComponent implements OnInit {
evt.preventDefault();
}
this._service.storeCookie();
this._service.storeCookie(this.cookieName);
this.animation = this.position === 'top' ? 'topOut' : 'bottomOut';
}
}

View File

@ -12,12 +12,12 @@ import { Injectable } from '@angular/core';
export class CookieLawService {
seen(): boolean {
return this.cookieExists('cookieLawSeen');
seen(cookieName): boolean {
return this.cookieExists(cookieName);
}
storeCookie(): void {
return this.setCookie('cookieLawSeen');
storeCookie(cookieName): void {
return this.setCookie('cookieName');
}
/**