-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds cookies support for Angular Universal #177
Conversation
@@ -85,7 +88,7 @@ export class CookieService { | |||
name = encodeURIComponent(name); | |||
|
|||
const regExp: RegExp = CookieService.getCookieRegExp(name); | |||
const result: RegExpExecArray = regExp.exec(this.document.cookie); | |||
const result: RegExpExecArray = regExp.exec(this.isServer ? this.request?.headers.get('cookie') : this.document.cookie); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same condition goes to getAll
@pavankjadda that's good! the rest looks exactly how I had in mind. |
@stevermeister one other small thing. I do see other cookie management library ngx-cookie in Angular world. It would be nice if they can merge with us and have single repo for all Angular users. |
@pavankjadda I've sent them a message - salemdar/ngx-cookie#393 |
@pavankjadda let's finalize and merge this one? or still have any doubts? |
When cookie expires, the website loads forever. I will test it further and let you know. |
@pavankjadda we only proxy cookies from the request, right? we don't cache them so it should not be any issues with expiration time |
Exactly. It shouldn't be. I will do final tests and merge the PR. |
@stevermeister Can you give me access to NPM Repository? I couldn't publish beta version through Github actiona. My Npm id is jpavanaryan |
@pavankjadda sure thing, added |
Thanks. |
# Conflicts: # package-lock.json
…eJS stopped shipping those by default
@stevermeister this is ready for review. We can merge this PR. Few things to note
Let me know your thoughts |
agree. |
Done. Updated |
Hi @pavankjadda, could you please update me with the status of it? |
Hi @pavankjadda and @pavankjadda , Would this PR be ported back on ngx-cookie-service v12 or only available for v13 ? Thank you in advance for this! |
Hi, I'm interested too. Any news about this merge? Thanks <3 |
I don't see why not. But I will have to look into it. |
Looks like this PR was accidentally closed and the branch was deleted. Created new PR #199 with same changes |
In order to better understand this, I went through express.js tutorial. The
server.ts
has some basicexpress.js
code. After debugging for few hours, I was able to identify the issue. Here is the summaryrequest
object, but since our cookie service depends ondocument
object we can't access themREQUEST
in providers. We can achieve this by modifyingserver.ts
fileREQUEST
object in cookie service, which helps us to get cookies on server side throughREQUEST
AppServerModule
I checked this in my project and it works. Let me know your thoughts on this