Please help me to handle global variables :frowning.
I have developing App using rest API. My problem is when user login I have to store the API token into storage from server but my problem when I retrieve the token some time its return null value
here I share my code for reference how to handle the global variable that can retrieve from the server
Login.ts
this.auth.loginUser(this.loginForm.value)
.subscribe((data) =>{
console.log('login processing....');
if(data['api_status']==1)
{
this.storage.set('api_token',data['api_token']);
api.ts
public api_token:string;
async getToken(){
await this.storage.get('api_token').then(data=>{
this.api_token = data;
});
}