Created
September 1, 2017 14:16
-
-
Save AaronC81/9fd2146d164d0665ceb8dba8a34a44c3 to your computer and use it in GitHub Desktop.
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
var BhhsToken; | |
function BhhsInit() { | |
BhhsToken = localStorage.getItem("BhhsToken"); | |
} | |
function BhhsLoginRequired(callback) { | |
$.get("http://bhhssite.azurewebsites.net/api/loginRequired/" + BhhsToken, callback); | |
} | |
function BhhsLogin(username, password, callback) { | |
$.post("http://bhhssite.azurewebsites.net/api/login", { | |
"Username": username, | |
"Password": password | |
}, data => { | |
BhhsToken = data.token; | |
localStorage.setItem("BhhsToken", BhhsToken); | |
callback(data); | |
}); | |
} | |
function BhhsPeople(callback) { | |
$.ajax({ | |
url: "http://bhhssite.azurewebsites.net/api/people/" + BhhsToken, | |
type: "GET", | |
success: callback | |
}); | |
} | |
function BhhsTimetableFor(forWhom, callback) { | |
$.ajax({ | |
url: "http://bhhssite.azurewebsites.net/api/timetable/" + BhhsToken + "/" + forWhom, | |
type: "GET", | |
success: callback | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment