Hi! I'm trying to set cookie attributes like this example:
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { TranslateCacheModule, TranslateCacheSettings, TranslateCacheService } from 'ngx-translate-cache';
@NgModule({
imports: [
TranslateModule.forRoot(),
TranslateCacheModule.forRoot({
cacheService: {
provide: TranslateCacheService,
useFactory: (translateService, translateCacheSettings) => {
return new TranslateCacheService(translateService, translateCacheSettings)
},
deps: [ TranslateService, TranslateCacheSettings ]
},
cacheName: 'mylang', // default value is 'lang'.
cacheMechanism: 'Cookie', // default value is 'LocalStorage'.
cookieExpiry: 1, // default value is 720, a month. Set to a negative value and the cookie becomes a session cookie.
**cookieAttributes: 'SameSite=Strict; Secure' // no default, optional specification of additional attributes.**
})
],
...
})
export class AppModule {}
I get the following error:
ERROR in src/app/shared/components/language-picker/language-picker.module.ts:34:7 - error TS2345: Argument of type '{ cacheService: { provide: typeof TranslateCacheService; useFactory: (translateService: TranslateService, translateCacheSettings: TranslateCacheSettings) => TranslateCacheService; deps: (typeof TranslateService | typeof TranslateCacheSettings)[]; }; cacheMechanism: "Cookie"; cookieAttributes: string; }' is not assignable to parameter of type 'TranslateCacheConfig'.
Object literal may only specify known properties, and 'cookieAttributes' does not exist in type 'TranslateCacheConfig'.
If if go to the code cookieAttribute is not defined
Hi! I'm trying to set cookie attributes like this example:
I get the following error:
ERROR in src/app/shared/components/language-picker/language-picker.module.ts:34:7 - error TS2345: Argument of type '{ cacheService: { provide: typeof TranslateCacheService; useFactory: (translateService: TranslateService, translateCacheSettings: TranslateCacheSettings) => TranslateCacheService; deps: (typeof TranslateService | typeof TranslateCacheSettings)[]; }; cacheMechanism: "Cookie"; cookieAttributes: string; }' is not assignable to parameter of type 'TranslateCacheConfig'. Object literal may only specify known properties, and 'cookieAttributes' does not exist in type 'TranslateCacheConfig'.
If if go to the code cookieAttribute is not defined
export interface TranslateCacheConfig { cacheService: Provider; cacheName?: string; cacheMechanism?: CacheMechanismType; cookieExpiry?: number; }