Skip to content

Commit ad408ee

Browse files
134770: Fixed import errors due to js-cookie not exposing the CookieAttributes as a named export
(cherry picked from commit 397a3bb)
1 parent 04982fc commit ad408ee

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/app/core/auth/auth.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Store,
1010
} from '@ngrx/store';
1111
import { TranslateService } from '@ngx-translate/core';
12-
import { CookieAttributes } from 'js-cookie';
12+
import Cookies from 'js-cookie';
1313
import {
1414
Observable,
1515
of,
@@ -492,7 +492,7 @@ export class AuthService {
492492

493493
// Set the cookie expire date
494494
const expires = new Date(expireDate);
495-
const options: CookieAttributes = { expires: expires };
495+
const options: Cookies.CookieAttributes = { expires: expires };
496496

497497
// Save cookie with the token
498498
return this.storage.set(TOKENITEM, token, options);
@@ -580,7 +580,7 @@ export class AuthService {
580580

581581
// Set the cookie expire date
582582
const expires = new Date(expireDate);
583-
const options: CookieAttributes = { expires: expires };
583+
const options: Cookies.CookieAttributes = { expires: expires };
584584
this.storage.set(REDIRECT_COOKIE, url, options);
585585
this.store.dispatch(new SetRedirectUrlAction(isNotUndefined(url) ? url : ''));
586586
}

src/app/core/services/client-cookie.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import Cookies, { CookieAttributes } from 'js-cookie';
2+
import Cookies from 'js-cookie';
33

44
import {
55
CookieService,
@@ -9,13 +9,13 @@ import {
99
@Injectable()
1010
export class ClientCookieService extends CookieService implements ICookieService {
1111

12-
public set(name: string, value: any, options?: CookieAttributes): void {
12+
public set(name: string, value: any, options?: Cookies.CookieAttributes): void {
1313
const toStore = typeof value === 'string' ? value : JSON.stringify(value);
1414
Cookies.set(name, toStore, options);
1515
this.updateSource();
1616
}
1717

18-
public remove(name: string, options?: CookieAttributes): void {
18+
public remove(name: string, options?: Cookies.CookieAttributes): void {
1919
Cookies.remove(name, options);
2020
this.updateSource();
2121
}

src/app/core/services/cookie.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { CookieAttributes } from 'js-cookie';
2+
import Cookies from 'js-cookie';
33
import {
44
Observable,
55
Subject,
@@ -12,9 +12,9 @@ export interface ICookieService {
1212

1313
get(name: string): any;
1414

15-
set(name: string, value: any, options?: CookieAttributes): void;
15+
set(name: string, value: any, options?: Cookies.CookieAttributes): void;
1616

17-
remove(name: string, options?: CookieAttributes): void;
17+
remove(name: string, options?: Cookies.CookieAttributes): void;
1818
}
1919

2020
@Injectable()
@@ -28,12 +28,12 @@ export abstract class CookieService implements ICookieService {
2828
public abstract set(
2929
name: string,
3030
value: any,
31-
options?: CookieAttributes,
31+
options?: Cookies.CookieAttributes,
3232
): void;
3333

3434
public abstract remove(
3535
name: string,
36-
options?: CookieAttributes,
36+
options?: Cookies.CookieAttributes,
3737
): void;
3838

3939
public abstract get(name: string): any;

src/app/core/services/server-cookie.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
Inject,
33
Injectable,
44
} from '@angular/core';
5-
import { CookieAttributes } from 'js-cookie';
5+
import Cookies from 'js-cookie';
66

77
import { REQUEST } from '../../../express.tokens';
88
import {
@@ -19,14 +19,14 @@ export class ServerCookieService extends CookieService implements ICookieService
1919
public set(
2020
name: string,
2121
value: any,
22-
options?: CookieAttributes,
22+
options?: Cookies.CookieAttributes,
2323
): void {
2424
return;
2525
}
2626

2727
public remove(
2828
name: string,
29-
options?: CookieAttributes,
29+
options?: Cookies.CookieAttributes,
3030
): void {
3131
return;
3232
}

0 commit comments

Comments
 (0)