ソースを参照

If you aren't logged in, station links redirect to 404

theflametrooper 8 年 前
コミット
9650b90e33
2 ファイル変更12 行追加0 行削除
  1. 9 0
      frontend/components/Station/Station.vue
  2. 3 0
      frontend/main.js

+ 9 - 0
frontend/components/Station/Station.vue

@@ -90,6 +90,7 @@
 	import OfficialHeader from './OfficialHeader.vue';
 	import CommunityHeader from './CommunityHeader.vue';
 	import io from '../../io';
+	import auth from '../../auth';
 
 	export default {
 		data() {
@@ -404,12 +405,19 @@
 		},
 		ready: function() {
 			let _this = this;
+
 			Date.currently = () => {
 				return new Date().getTime() + _this.systemDifference;
 			};
+
 			_this.stationId = _this.$route.params.id;
+
 			window.stationInterval = 0;
 
+			auth.getStatus(isLoggedIn => {
+				if (!isLoggedIn) _this.$router.go('/404');
+			});
+
 			io.getSocket((socket) => {
 				_this.socket = socket;
 
@@ -424,6 +432,7 @@
 					if (res.status === 'error') {
 						_this.$router.go('/404');
 						Toast.methods.addToast(res.message, 3000);
+						console.log('yup')
 					}
 				});
 

+ 3 - 0
frontend/main.js

@@ -65,6 +65,9 @@ router.map({
 	'*': {
 		component: NotFound
 	},
+	'404': {
+		component: NotFound
+	},
 	'/terms': {
 		component: Terms
 	},