Hi,
I’m trying to read a token from the Ionic storage with a “get”.
I know it returns a Promise but I’ve defined this asynchronous method:
async getToken() {
return await this.storage.get('TOKEN_KEY');
}
getWsHeader() {
let tempToken;
tempToken = this.getToken();
console.log('@@@@@@@ TOKEN:', tempToken);
When I run this code the variable “tempToken” is not a string but it is still a Promise.
How is it possible?
This is what I see in the Chrome console about “tempToken”:
ZoneAwarePromise {__zone_symbol__state: null, __zone_symbol__value: Array(0)}
I’m using this version of Ionic:
Ionic:
ionic (Ionic CLI) : 4.12.0
Ionic Framework : @ionic/angular 4.1.2
@angular-devkit/build-angular : 0.13.6
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.6
@ionic/angular-toolkit : 1.4.1
System:
NodeJS : v10.15.1
npm : 6.7.0
OS : Windows 10
Thank you very much
cld