diff --git a/Public/login.html b/Public/login.html
index 17b43ab..bc9563a 100644
--- a/Public/login.html
+++ b/Public/login.html
@@ -39,15 +39,16 @@
return
}
performLoginPlayerRequest(username, password)
- .then(function(token) {
- storePlayerNameAndToken(username, token)
- window.location.href = "schafkopf.html";
- }).catch(function(error) {
+ .catch(function(error) {
console.log("Failed to log in")
console.log(error)
// TODO: Create better error message for user
setTextHint(error);
})
+ .then(function(token) {
+ storePlayerNameAndToken(username, token);
+ showTableList();
+ })
}
function showDebugLogins() {
diff --git a/Public/login.js b/Public/login.js
index 5e67705..d4da7af 100644
--- a/Public/login.js
+++ b/Public/login.js
@@ -55,10 +55,15 @@ function loadExistingSession() {
resumeSessionRequest(token)
.then(function(name) {
storePlayerNameAndToken(name, token);
- window.location.href = "list.html";
+ showTableList();
}).catch(function(error) {
// We don't expect a session to resume if the registration page is shown,
// and if the token is expired on the login page we just fail quietly.
console.log(error);
+ deleteSessionToken();
})
}
+
+function showTableList() {
+ window.location.href = "list.html";
+}