Using persistent causes an error
strotgen opened this issue · comments
Hi John, thanks for developing this package.
I upgraded recently and started getting the following error:
Uncaught SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at new Gate (vue-gates.js?e1b1:221)
at Object.install (vue-gates.js?e1b1:323)
at Function.Vue.use (vue.runtime.esm.js?2b0e:5107)
at eval (vue-gates.js?511d:4)
at Module../plugins/vue-gates.js (app.js:951)
Checking the source code, I saw that the constructor is trying to parse localStorage.getItem('roles')
but this returns undefined, hence the error.
I'm using Nuxt, latest version. And I set the roles and permissions inside a Nuxt Auth plugin.
Is this an expected behaviour or am I doing something wrong? If not, I can PR a quick fix for this.