summaryrefslogtreecommitdiff
path: root/src/client/buttons.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-01-12 14:49:50 +0200
committerAlon Levy <alon@pobox.com>2015-01-12 14:49:50 +0200
commit9727204ed66ef0d6acfbf4df0bf49f5e4d9c10ba (patch)
tree1be6e31843b8b7502e48811549c03127de9e5b03 /src/client/buttons.js
parent22b0069cff76f5cb95c6f6f4fa9909cfa7bfba4e (diff)
login+logout: using ajax, not POST, plus document.window (worst of both worlds)
Diffstat (limited to 'src/client/buttons.js')
-rw-r--r--src/client/buttons.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/client/buttons.js b/src/client/buttons.js
index 5fd8d121..dfd2c5f3 100644
--- a/src/client/buttons.js
+++ b/src/client/buttons.js
@@ -67,6 +67,21 @@ $('.local-storage-load a').click(function(){
rz_core.load_from_json(json_blob);
});
+var logout_button = $('#logout-button');
+logout_button.click(function() {
+ $.ajax({
+ type: "POST",
+ url: '/logout',
+ success: function () {
+ document.location = "/login";
+ },
+ error: function () {
+ console.log("failed to logout");
+ document.location = "/login";
+ },
+ }); // server should redirect back to /login
+});
+
$('a.save-history').click(function() {
if (rz_core.main_graph.history === undefined) {
throw "History is undefined";