Skip to content

Commit 932a2a2

Browse files
fix(cookies): add targetValueChange to server variant
1 parent 74b9987 commit 932a2a2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/modules/cookies/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface KeyValue {
99
export interface ICookieService {
1010
readonly valueChange: Observable<KeyValue>
1111
readonly valueChanges: Observable<StringDict>
12+
readonly targetValueChange: (key: string) => Observable<KeyValue>
1213
readonly getAll: () => any
1314
readonly get: (name: string) => any
1415
readonly set: (name: string, value: any, options?: CookieAttributes) => void

src/modules/cookies/cookies.server.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { empty } from 'rxjs'
22
import { REQUEST } from '@nguniversal/express-engine/tokens'
33
import { Inject, Injectable } from '@angular/core'
4-
import { CookieAttributes } from 'js-cookie'
54
import { ICookieService } from './common'
65
import * as express from 'express'
76

@@ -14,6 +13,10 @@ export class ServerCookieService implements ICookieService {
1413

1514
constructor(@Inject(REQUEST) private req: express.Request) {}
1615

16+
targetValueChange() {
17+
return empty()
18+
}
19+
1720
public get(name: string): any {
1821
try {
1922
return JSON.parse(this.req.cookies[name])
@@ -26,11 +29,11 @@ export class ServerCookieService implements ICookieService {
2629
return this.req && this.req.cookies
2730
}
2831

29-
public set(name: string, value: any, opts?: CookieAttributes): void {
32+
public set(): void {
3033
// noop
3134
}
3235

33-
public remove(name: string, opts?: CookieAttributes): void {
36+
public remove(): void {
3437
// noop
3538
}
3639

0 commit comments

Comments
 (0)