Created
April 23, 2015 23:05
-
-
Save zxqx/ff5817d6842caa932d78 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* Authenticate a user | |
*/ | |
export default class Auth | |
{ | |
constructor($http, envSettings) | |
{ | |
this.$http = $http; | |
this.envSettings = envSettings; | |
} | |
async authenticate(username:string, password:string): Promise<void> | |
{ | |
let env = await this.envSettings.get(); | |
let baseURI = env.baseURI; | |
try { | |
let res = await this.$http.post(`${baseURI}/api/login`, | |
{ username: username, password: password }); | |
console.log('Successfully logged in'); | |
} | |
catch(e) { | |
console.log(e.data.error); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment