diff --git a/velconnect/static/js/util.js b/velconnect/static/js/util.js index e386324..dae3ab8 100644 --- a/velconnect/static/js/util.js +++ b/velconnect/static/js/util.js @@ -98,7 +98,6 @@ function writeSrc(className, data) { } function timeSince(date) { - let seconds = Math.floor((new Date() - date) / 1000); let interval = seconds / 31536000; @@ -127,7 +126,7 @@ function timeSince(date) { function timeSinceString(date) { - date = Date.parse(date); + date = Date.parse(date + "Z"); let seconds = Math.floor((new Date() - date) / 1000); let interval = seconds / 31536000; diff --git a/velconnect/templates/index.html b/velconnect/templates/index.html index 2b350fd..8d6b095 100644 --- a/velconnect/templates/index.html +++ b/velconnect/templates/index.html @@ -152,6 +152,10 @@ console.log(resp); let respData = JSON.parse(resp); + if ("error" in respData) { + window.location.href = "/pair"; + } + writeClass('hw_id', respData['user']['hw_id']); writeValue('current_room', respData['user']['current_room']); writeClass('date_created', respData['user']['date_created'] + "
" + timeSinceString(respData['user']['date_created']) + " ago");