Skip to content

Commit

Permalink
Have dashboard properly render memo list, have login page forward to …
Browse files Browse the repository at this point in the history
…dashboard when login is successful
  • Loading branch information
alyx committed May 20, 2012
1 parent 356b3f0 commit 5d59f48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 5 additions & 9 deletions public/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -31,7 +28,6 @@ function checkMemos()
success: function(res) {
if (res.list === undefined || res.list === null)
{
console.log("Rechecking");
window.setTimeout(checkMemos, 250);
return;
}
Expand All @@ -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");
}
Expand Down
10 changes: 7 additions & 3 deletions public/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
});
});
Expand All @@ -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";
}
}
});
}
Expand Down

0 comments on commit 5d59f48

Please sign in to comment.