Passing Storage Values

I am trying to pass ionic storage values set in a constructor to a function within my remote service provider file. I am able to present the value in console but get undefined in the function.

constructor(private http:Http, private storage: Storage) {“username”).then((username)=>{
if(username != null) {
this.username = username;
console.log('Username is ’ + this.username)
} else {
console.log(“No username”);

getPhotos() {
var url = ‘http://localhost:2222/public/api/photos/’ + this.username;
var response = this.http.get(url).map(res => res.json().data);
return response;

When I hard-code the username, it works. Any help is appreciated.

storage.get returns a Promise. Your variable response is of type Promise. You’re treating response as though it’s the same as res, and it isn’t.