Git Product home page Git Product logo

vue-cookie's People

Contributors

alfhen avatar jackie19 avatar linroex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-cookie's Issues

check cookie is exists

Hi,
the error said, "document is not defined"
for VueCookie.get('username')
when I don't store any session
so, how to check the session first?

please add typescript support

if you try to import it in a typescript VueJS project (i.e. in main.ts) it gives an error saying types are not defined.

Watch cookie change

Hello,

It is possible to watch a cookie changement in the vuejs watch property ?

cookie return value

Hi, I have a cookie set with an array object. but when I log the value returned its of type string, hence I get this => [ object Object] , [ object Object ] ....
Any idea what I'm doing wrong?

Vue-cookie integration with Vuex

Hi there! I'm totally new with Vue and front-end in general (I'm backend java developer 😄) therefore I might ask dumb questions, but I'm trying to build a simple Vue app with Vuex and cookie as security token. What I'm currently have:
main.js:

...
import Vue from "vue";
import vueCookie from "vue-cookies";
...

Vue.component(...);

Vue.use(vueCookie);
new Vue({
  el: "#app",
  router,
  store,
  template: "<App/>",
  components: {App}
}); 

auth.js:

import Vue from "vue";
...

const state = {
  token: this.$cookie.get('token') || "",
  ...
};

/// other auth code

When I run my app I get 'Cannot read property '$cookie' of undefined' at Vue.prototype.$cookie.get('token') line. What I'm doint wrong?

unable to get cookie

Hi, I am passing a cookie to the browser from my backend, it shows up on the browser cookie extension just fine, but this.$cookie.get('my-cookie') returns null.. any thoughts? and the cookie is not expired.

get method doesn't works correctly

If i add a new cookie by the setmethod then with the getmethod i can fetch it.
BUT if i use the getmethod to fetch a cookie that already exist (so i din't use the setmethod). In that case the getmethod doesnt find anything!

how to put '@' in cookie?

I wanna put in the cookie a string which contains '@', but only string before '@' being saved. How can I do that ?

how to get key's value when cookie is string

cookie: 'JSESSIONID=node0puin2x7jukign9qrxudu6bvn2.node0; token=92bc658822c92197e3c86f39a5e420f2; connect.sid=s%3AH8OLTKl1mNm_Sx3aFL0DyZ1L1wlKHm9W.zUqgaxcUoefwyGbof9jgBeGYEsaHIyaWQwNSbc3Q8Ho'

Cannot set JSON cookie

I want to set an JSON javascript object in the cookie: this.$cookie.set('test', JSON.stringify(this.json), 1);

Unfortunately, the cookie is not set. What am I doing wrong?

Getting $cookie undefined - beforeEach

i am using vue-cookie in my project, the cookie is set but when i use in the main.js
console.log(this.$cookie.get("test"))

i get the following error ..... any thoughts?
Cannot read property '$cookie' of undefined
Although this.$cookie.get("test") works in the components without any issue

TIA

SameSite - Secure

Please give ability to set the SameSite and Secure values in the $cookie.set

How to use this plugin by 'Vue.cookie'

I want to set a cookie in vuex's mutations.js file,

but when I use 'Vue.cookie' directly, there was an error occurred:

TypeError: WEBPACK_IMPORTED_MODULE_0_vue.default.cookie is not a function

Set cookie expiration time as unix timestamp

I'm using this library to store OAuth tokens and I want to set the expiration time of my access_token as the expires_in response, but it is in timestamp.

Could you provide a way of pass the timestamp and get the cookie saved with it as expiration time?

set a cookie disabled

In my project, cross-domain Settings are set in the background, when I send a axios request, I need to set an extra cookie, but it can't be effective.

getting an extra dot(.) in cookie domain

Hi i have a scenario where i have to create a cookie with the current hostname as domain, but it's adding an extra dot(.) before the hostname.

let domain = location.hostname
window.$cookies.set('name', 'value', '12h', '/', domain)

Ex: expected domain for cookie: abc.google.com actual domain name set in cookie .abc.google.com

Thanks.

Doesn't work without npm

Hey,

When i copy paste the build/vue-cookie.js to my own project and include below the vue.js include and try to call this.$cookie or Vue.cookie i get: Undefined get for undefined.

Does this work without npm?

TypeError: Cannot read property '$cookies' of undefined

import Vue from "vue";
import VueCookies from 'vue-cookies';
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Axios from "axios";
import Api from "./index";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";

Vue.config.productionTip = false;
Vue.use(VueCookies)
Vue.use(ElementUI);
Vue.prototype.$http = Api;
new Vue({
VueCookies,
router,
store,
Axios,
ElementUI,
render: h => h(App)
}).$mount("#app");

Add getAll() support

Would be great if you could add support for the getAll() function. Could really use that.

isInteger ES6 browser support

Hi,

I noticed you use the isInteger function on line 13. But this is not supported by all browsers like IE11 and older.
Is it maybe possible to adjust to make it browser compatible?

possible solution:

Number.isInteger = Number.isInteger || function(value) {
    return typeof value === "number" && 
           isFinite(value) && 
           Math.floor(value) === value;
};

cookies are being encoded

I'm having the following problem:
When I create a cookie by Vue.$cookies.set('example', "user=myself")
The stored cookie becomes user%3Dmyself, but I want it to be exactly as user=myself, that is, they are being encoded.
Is there any option avaiable so that the cookies are not encoded?

Why plugin?

I find this project interesting. Can you explain why not to use tiny-cookie directly? What are the benefits of using Vue plugin?

It would be great if the answers could be added to the README.

Vuex integration method

Hi there,
this plugin is comfy (thank you, mr. Alfhen) , but if you want to incapsulate smth in vuex store (for example the choice between cookie and local storage), you may have an issue: from-the-box vuex doesn't know about this.$cookie or vm.$cookie.

All u need is just reinitialize that. Look on the pictures.
vuex store
app call

Unable to remove cookie on https domain

when the cookie is set on the server side, it has httpOnly set to false, secure to false.
I can access the cookie in the SPA, but unable to delete it(set it to past).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.