ng-web-apis icon indicating copy to clipboard operation
ng-web-apis copied to clipboard

feat(COOKIE): add new token

Open AlexanderFSP opened this issue 3 years ago • 4 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows Conventional Commits
  • [x] Tests for the changes have been added (for bug fixes / features)
  • [x] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [x] Feature
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

AlexanderFSP avatar Nov 29 '20 12:11 AlexanderFSP

Hi Alexander! Thank you for your Pull Request, we'll take a look soon 👍

MarsiBarsi avatar Nov 29 '20 14:11 MarsiBarsi

Hi, sorry for the long response. I have some points, which I would like to clarify.

  1. If it'll be realized as I did it initially - this cookie token will holds the primitive string value and wouldn't reflect changes automatically. And seems to me, this token will be pretty useless) So, I have a bit changed the implementation to fix this issue. Of course, the realization of this service can be like as ngx-cookie-service provides, but I think it's not needed for now... So, what do you think about this approach?

image

  1. Another interesting which I've found, that if we try to get cookie value from the server side - we got a NotYetImplemented error (from the domino). So, this thing should be wrapped with try-catch (as I did it above).

image

AlexanderFSP avatar Dec 03 '20 20:12 AlexanderFSP

What is the point of it then? You inject an object, you get/set its property. It's the same amount of code as just working with DOCUMENT :)

waterplea avatar Dec 04 '20 07:12 waterplea

@waterplea , yup) But if you do it like this, the application will crash (if we are talking about universal).. And my wish was initially to have kinda abstraction over cookie string for all platforms (for SSR create a new token in ng-web-apis/universal package which extracts cookie from the request headers & sets updated cookies in the response headers). That's my idea)

AlexanderFSP avatar Dec 04 '20 09:12 AlexanderFSP