Переглянути джерело

Move into clause so that cookies have been added to store at time of check

sbkwgh 8 роки тому
батько
коміт
508143c886
1 змінених файлів з 8 додано та 5 видалено
  1. 8 5
      src/components/routes/Admin.vue

+ 8 - 5
src/components/routes/Admin.vue

@@ -46,11 +46,14 @@
 		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)
-			}
+			this.$nextTick(() => {
+				if(!this.$store.state.admin) {
+					this.$router.push('/')
+					this.$store.commit('setAccountTabs', 1)
+					this.$store.commit('setAccountModalState', true)
+				}
+			})
+			
 		}
 	}
 </script>