nuxt-community / universal-storage-module

Universal Storage Utilities for Nuxt 2
MIT License
276 stars 15 forks source link

Feature: Expiry #99

Open Jamiewarb opened 4 years ago

Jamiewarb commented 4 years ago

I'm wondering if you or other users would consider an expiration feature useful?

For example, it could work similar to how cookies expire, setting an expiry length that is set on the cookie, and also replicated to Vuex and localStorage, so a value that's expired is deleted when the app loads.

Happy to write the code for the feature if we think it would be a useful addition, and can discuss how it should work. Right now I'm rolling it myself via a decorator.

ProsperChiduku commented 3 years ago

Our team (7 of us ) would really love to have this feature.

farzadso commented 3 years ago

Sorry for the late reply. I would love it if either of you opened a PR for this feature @Jamiewarb @ProsperChiduku

Atinux commented 3 years ago

I thin it would be nice, it could be as 3rd argument:

$storage.setUniversal('token', token, { ttl: 60 })

The issue is mostly to remove it from the state automatically that makes it tricky.