Created
August 26, 2019 02:33
-
-
Save rdlabo/d93361c8b06df0fbde26df1c91f9fa01 to your computer and use it in GitHub Desktop.
Ionic Storage & HTTP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class AuthService { | |
constructor( | |
public http: HttpClient, | |
public storage: Storage, | |
) {} | |
async getState() { | |
const token = await this.storage.get('token'); | |
const httpOptions = { | |
headers: new HttpHeaders({ | |
'Content-Type': 'application/json', | |
'Authorization': token | |
}) | |
}; | |
return this.http.get('functions/auth', httpOptions); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment