victorsferreira / vue-session

A simplistic session plugin for VueJS backed by SessionStorage and LocalStorage
203 stars 42 forks source link

"Remember me" persistence? #21

Open danielalejandromatheus opened 5 years ago

danielalejandromatheus commented 5 years ago

Hey guys, I just got this dependency and so far it's great!

I have a question though, can I make the persistence on the "options" depend on a "remember me" check/token?

SjamonDaal commented 4 years ago

Don't really know the answer to this but I don't think so at this point.

It could be enabled by setting

Vue.use(VueSession, { persist: true })

But I only tried it from the Vue router.js

danielalejandromatheus commented 4 years ago

Sorry the title isn't self explanatory, let me elaborate. In some webs you can toggle a persistence with a 'Remember Me' check, what I meant by "Remember Me" persistence is toggling it programmatically from inside a component,, something like:

login(){
//some login logic
if(this.remember){
   this.$session.options.persist = true;
}else this.$session.options.persist = false
this.$session.start()
}
SjamonDaal commented 4 years ago

I did understand your question but this doesn't work right?

login(){
//some login logic
if(this.remember){
   this.$session.options.persist = true;
}else this.$session.options.persist = false
this.$session.start()
}
danielalejandromatheus commented 4 years ago

It doesn't, you can either enable it or disable it only when you install it to your Vue instance like you said above

SjamonDaal commented 4 years ago

Okay, persist also means something else in this case.

In the module it provides crosstab/browser instance persistence of the session.