PillowPillow/ng2-webstorage

Angular 9 combability

Closed this issue · 0 comments

Versions (please complete the following information):

  • NgxWebstorage: [ tested in all version greater than 2.0.0]
  • Angular: [e.g. 9.1.12]

Describe the bug
Trying to store and retrieve data from local storage

To Reproduce
Steps to reproduce the behavior:

  1. import in app module
    NgxWebstorageModule.forRoot({prefix: 'sys', separator: '.', caseSensitive: true}),
  2. Try to get it
    const token = this.localStorage.retrieve(SESSION_AUTH_TOKEN) || this.sessionStorage.retrieve('authenticationToken');
    where SESSION_AUTH_TOKEN is a constant to assign session storage name according with domain
  3. See error
    core.js:6241 ERROR TypeError: Cannot read property 'get' of undefined at SessionStorageService.retrieve (ngx-webstorage.js:75) at AuthInterceptor.intercept (auth.interceptor.ts:18) at HttpInterceptorHandler.handle (http.js:1958) at HttpXsrfInterceptor.intercept (http.js:2819) at HttpInterceptorHandler.handle (http.js:1958) at HttpInterceptingHandler.handle (http.js:2895) at MergeMapSubscriber.project (http.js:1682) at MergeMapSubscriber._tryNext (mergeMap.js:46) at MergeMapSubscriber._next (mergeMap.js:36) at MergeMapSubscriber.next (Subscriber.js:49)
    Expected behavior
    implemented in another project with angular 7 and it works perfectly, I don't understand that it may be missing

Desktop (please complete the following information):

  • Browser [Microsoft chrome,]