Starting 404 for videos

This commit is contained in:
Patrick Hatsune 2024-06-06 15:16:55 -07:00
parent afc1cc571c
commit eb487dea0a
Signed by: keyemail
GPG key ID: 487C4334CE04CE66
2 changed files with 19 additions and 5 deletions

View file

@ -25,15 +25,18 @@ const routes = [
}, },
{ {
path: '/:pathMatch(.*)', path: '/:pathMatch(.*)',
name: '404',
component: notFoundPage component: notFoundPage
}, },
{ {
path: '/videos', path: '/videos',
name: 'video',
component: videoView component: videoView
}, },
{ {
path: '/videos/:id', path: '/videos/:id',
component: videosView name: 'videos',
component: videosView
} }
] ]

View file

@ -1,8 +1,17 @@
<template> <template>
<h1>{{ video.videoName }}</h1> <template v-if="notFound">
<video controls> <div class="notFound">
<source :src="require('@/assets/' + video.path)" type="video/mp4"> <h1>404 Page</h1>
</video> <p>This page has not been found, <router-link to="/">click here</router-link> to return back home.</p>
</div>
</template>
<template v-else>
<h1>{{ video.videoName }}</h1>
<video controls>
<source :src="require('@/assets/' + video.path)" type="video/mp4">
</video>
</template>
</template> </template>
<script> <script>
@ -12,11 +21,13 @@
data () { data () {
return { return {
video: null, video: null,
notFound: false
} }
}, },
created() { created() {
let videoID = this.$route.params.id; let videoID = this.$route.params.id;
this.video = videoData.find(v => v.videoID === videoID); this.video = videoData.find(v => v.videoID === videoID);
console.log(this.notFound);
} }
} }
</script> </script>