From 3bdddb0b105b457f4213e71324a668f162a8fb88 Mon Sep 17 00:00:00 2001
From: Cliff Li <lic@student.ethz.ch>
Date: Sat, 17 Mar 2018 16:24:08 +0100
Subject: [PATCH] Fix some pages not accessible

---
 src/views/layout.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/views/layout.js b/src/views/layout.js
index 34618109..6e1f115a 100644
--- a/src/views/layout.js
+++ b/src/views/layout.js
@@ -16,6 +16,7 @@ export default class Layout {
     checkLogin();
     this.setTabs();
     this.selectedTabIndex = 0;
+    this.lastTabIndex = this.selectedTabIndex;
     this.wasLoggedIn = isLoggedIn();
   }
 
@@ -57,8 +58,11 @@ export default class Layout {
   onupdate() {
     if (this.wasLoggedIn !== isLoggedIn()) this.selectedTabIndex = 0;
     this.wasLoggedIn = isLoggedIn();
+    if (this.lastTabIndex !== this.selectedTabIndex) {
+      this.lastTabIndex = this.selectedTabIndex;
+      this.selectTab(this.selectedTabIndex);
+    }
     this.setTabs();
-    this.selectTab(this.selectedTabIndex);
   }
 
   view(vnode) {
-- 
GitLab