瀏覽代碼

Commit 7-4: Show a loading screen while waiting to login.

- login is too fast to see it in local dev conditions.
Frederic G. MARAND 9 年之前
父節點
當前提交
6b2f61adf0
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      lib/router.js

+ 7 - 1
lib/router.js

@@ -41,7 +41,13 @@ Router.onBeforeAction('dataNotFound', {
 
 var requireLogin = function () {
   if (!Meteor.user()) {
-    this.render('accessDenied');
+    if (Meteor.loggingIn()) {
+      // Défini dans Router.configure().
+      this.render(this.loadingTemplate)
+    }
+    else {
+      this.render('accessDenied');
+    }
   }
   else {
     this.next();