cmp-cc / vue-cookies

A simple Vue.js plugin for handling browser cookies
MIT License
408 stars 70 forks source link

window.$cookies.get('cookie-name') // what if I have many cookies with same name? #8

Closed JosielFaleiros closed 4 years ago

JosielFaleiros commented 6 years ago

My question is, what if I have many cookies in the same domain, but in different paths, how would I get a token from a specif path using vue-cookies? I ask this, because when I try to do so, the window.$cookies.get('cookie-name') returns just the cookie in the path were it was called from and not the one with same name but in different paths. I still tried window.$cookies.get('cookie-name', '/specific-path') but same result.

Thanks for your attention, and awesome contribution with vue-cookies :D

cmp-cc commented 6 years ago

thank u very much

not support, now https://stackoverflow.com/questions/32579803/how-to-get-cookies-path-using-javascript

spa temporary solution

https://jsfiddle.net/cmpcc/Lcu71h5n/43/

multiple page dev

  window.$cookies.set("cookie-name","lock_e.3421.h.1","24d","/home/");
  window.$cookies.set("cookie-name","lock_e.3421.h.2","24d","/news/");
   window.$cookies.get("cookie-name")  
in /home path :lock_e.3421.h.1
in /news  path :lock_e.3421.h.2