summaryrefslogtreecommitdiff
path: root/assets/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/app.js')
-rw-r--r--assets/js/app.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/assets/js/app.js b/assets/js/app.js
index 65cc824a..ff584d87 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -128,6 +128,22 @@ var Kanboard = (function() {
$(".preview-area").hide();
},
+ // Check session and redirect to the login page if not logged
+ CheckSession: function() {
+
+ if (Kanboard.IsVisible() && ! $(".form-login").length) {
+ $.ajax({
+ cache: false,
+ url: $("body").data("status-url"),
+ statusCode: {
+ 401: function(data) {
+ window.location = $("body").data("login-url");
+ }
+ }
+ });
+ }
+ },
+
// Common init
Init: function() {
@@ -151,6 +167,9 @@ var Kanboard = (function() {
// Markdown Preview for textareas
$("#markdown-preview").click(Kanboard.MarkdownPreview);
$("#markdown-write").click(Kanboard.MarkdownWriter);
+
+ // Check the session every 10s
+ window.setInterval(Kanboard.CheckSession, 10000);
}
};