You can use promises with async/await
async getUser() {
if (this.storage.token == null || this.storage.token == '') {
return;
}
const t = await this.net.get<LoginModel>(`Authentication/GetUser`).toPromise();
this.storage.token = t.token;
this.storage.user = t.user;
console.log(this.storage.user);
}
See more:
- Promises
- async
- await
- ES8 async/await
- async/await tutorial
- async/await explained