I have an authentication service which saves the token and the result of saving the token is a promise. I would like the value to be returned to another function only after the promise is resolved.

This is my authservice which saves the token:

```
login(user: UserModel): Observable<any> {
    return this._http.postnoAuth(this.loginurl + "mobile-login", body)
        .map((response: Response) => {
            let token = response.json() && response.json().access_token;

            if (token){
                this._storage.set('currentUser', JSON.stringify({token: token}))
                .then(res=>{
                     return true; //return true after the promise is resolved
                });
            }
            else{
                return false;
            }
        })
    //.catch(this.handleError);
}

```

Then I am subscribing to the above:

```
this._authservice.login(this.user).subscribe(respose => {
    if(response){  //expecting true here
        console.log("true");
    }
    else{
        console.log("false");
    }
    loader.dismiss();
        this.submitted = false;
    },
    error=> {
        this.submitted = false;
    }
);

```

Above code always logs false, even when the value of storage has been set, What could be wrong?