瀏覽代碼

Redirect if not admin

sbkwgh 8 年之前
父節點
當前提交
6c32808510
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/components/routes/Admin.vue

+ 6 - 0
src/components/routes/Admin.vue

@@ -45,6 +45,12 @@
 		},
 		created () {
 			this.selected = this.$route.path.split('/')[2]
+
+			if(!this.$store.state.admin) {
+				this.$router.push('/')
+				this.$store.commit('setAccountTabs', 1)
+				this.$store.commit('setAccountModalState', true)
+			}
 		}
 	}
 </script>