Trouble using storage module inside a custom service


For some reason I am having trouble accessing the storage service and setting storage properties with my custom auth service.

I have a login method that should hit my API, get a token, decode the token and store the user information via storage. This all works if I do this in the login promise but that seems like an anti-pattern to me.

I’ve imported the storage module…

import { Storage } from '@ionic/storage';

And injected into the constructor…

constructor(private http: Http, private storage: Storage) {}

And then when I try to use it in the response from the http service…

...'profile', this.user);

I get the error

Cannot read property 'set' of undefined

I can’t seem to find online how it should work within a service differently from within a module.