summaryrefslogtreecommitdiff
path: root/src/scripts/user.ts
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-01-26 23:26:20 +0100
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-01-26 23:26:20 +0100
commitb0b5253f66f5ba6e031f5a88dc1bef613517b3b6 (patch)
treef764e84ad48de6cb514cbc97e366c21d734e247c /src/scripts/user.ts
parent027b379cf9d53a12782781e586f79051461ab661 (diff)
Refactor remaining codebase to use 'const'
Diffstat (limited to 'src/scripts/user.ts')
-rw-r--r--src/scripts/user.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/scripts/user.ts b/src/scripts/user.ts
index dda2dcab..7b157603 100644
--- a/src/scripts/user.ts
+++ b/src/scripts/user.ts
@@ -36,7 +36,7 @@ window["gapiSigninButton"] = () => {
gapi.signin2.render('google-signin', {
'scope': 'profile email',
'onsuccess': (googleUser) => {
- let auth2 = gapi.auth2.getAuthInstance();
+ const auth2 = gapi.auth2.getAuthInstance();
// Handle signout click
$("nav .user .sign-out").click(() => {
@@ -47,12 +47,12 @@ window["gapiSigninButton"] = () => {
});
// Check if the token has expired
- let currentTime = (new Date()).getTime() / 1000;
+ const currentTime = (new Date()).getTime() / 1000;
if (parseInt(localStorage.getItem("googleTokenExpiration")) - currentTime <= 0) {
auth2.signIn().then(() => {
localStorage.setItem("googleToken", googleUser.getAuthResponse().id_token);
- let expirationTime = (new Date()).getTime() / 1000 + parseInt(googleUser.getAuthResponse().expires_in) - 5;
+ const expirationTime = (new Date()).getTime() / 1000 + parseInt(googleUser.getAuthResponse().expires_in) - 5;
localStorage.setItem("googleTokenExpiration", expirationTime.toString());
});
}
@@ -73,4 +73,4 @@ export function removeUserInfo() {
localStorage.removeItem("googleEmail");
localStorage.removeItem("userId");
localStorage.removeItem("simulationId");
-} \ No newline at end of file
+}