Add support for clips

This commit is contained in:
root
2022-02-11 17:22:00 +05:30
parent 5d15876414
commit f136887671
2 changed files with 46 additions and 0 deletions
+6
View File
@@ -3,6 +3,7 @@ import VueRouter from 'vue-router'
import VueMeta from 'vue-meta'
import FeedPage from '@/routes/FeedPage'
import ClipRedir from '@/routes/ClipRedir'
Vue.use(VueMeta)
Vue.use(VueRouter)
@@ -47,6 +48,11 @@ const routes = [
name: 'WatchVideo',
component: () => import('@/routes/WatchVideo')
},
{
path: '/clip/:clipId',
name: 'Clips',
component: ClipRedir
},
{
path: '/:path(channel|user|c)/:channelId/:videos?',
name: 'Channel',
+40
View File
@@ -0,0 +1,40 @@
<template>
<NGErrorHandler v-if="error" :error="error" />
</template>
<script>
import NGErrorHandler from '@/components/NGErrorHandler'
export default {
components: { NGErrorHandler },
data: () => ({
error: null
}),
async mounted () {
let out
try {
out = await this.$store.dispatch('auth/makeRequest', {
method: 'GET',
path: '/clips/' + this.$route.params.clipId
})
} catch (e) {
if (e.isAxiosError) {
this.error = e.response.data
} else {
throw e
}
}
if (out.videoId) {
this.$router.push({
path: '/video',
query: {
v: out.videoId
}
})
}
}
}
</script>