Permalink
Browse files

Have dashboard properly render memo list, have login page forward to …

…dashboard when login is successful
  • Loading branch information...
1 parent 356b3f0 commit 5d59f48f1b5cdcda9b167a34ab22b0a61eb34632 @alyx committed May 20, 2012
Showing with 12 additions and 12 deletions.
  1. +5 −9 public/js/dashboard.js
  2. +7 −3 public/js/login.js
View
@@ -4,18 +4,15 @@ $("#waiting").modal({
show: true
});
-console.log("Cookie UUID: " + $.cookie("awp_uuid"));
-
$.ajax({
url: '/atheme/do/memoserv/list',
type: 'POST',
data: 'uuid=' + $.cookie("awp_uuid"),
dataType: 'json',
success: function(res) {
- console.log("Succes!")
+ console.log(res);
if (res.list === null)
{
- console.log("Checked..");
window.setTimeout(checkMemos, 250);
}
}
@@ -31,7 +28,6 @@ function checkMemos()
success: function(res) {
if (res.list === undefined || res.list === null)
{
- console.log("Rechecking");
window.setTimeout(checkMemos, 250);
return;
}
@@ -42,10 +38,10 @@ function checkMemos()
}
else
{
- console.log("Looping");
- res.list.messages.forEach(function(element) {
- $("<p>" + element + "<p>").insertAfter($('h1'));
- console.log(element);
+ var listing = JSON.parse(res.list);
+ listing.messages.forEach(function(element) {
+ var listEl = $("<li>" + element.from + " [" + element.when + "]</li>");
+ $("#memos").append(listEl);
});
$("#waiting").modal("hide");
}
View
@@ -43,7 +43,7 @@ $("input.login").click(function(){
$.cookie("awp_uuid", uuid);
window.setTimeout(250, checkLogin());
}
- else alert("Something fucked up.");
+ else console.log("Something fucked up.");
}
});
});
@@ -63,10 +63,14 @@ function checkLogin()
}
else if (res.authcookie === -1)
{
- alert("Authentication failed!");
+ console.log("Authentication failed!");
return;
}
- else alert("Authcookie: " + res.authcookie);
+ else
+ {
+ console.log("Authcookie: " + res.authcookie);
+ window.location.href = "/dash";
+ }
}
});
}

0 comments on commit 5d59f48

Please sign in to comment.