mirror of
https://github.com/mmjee/Piped-Material.git
synced 2024-12-06 19:26:36 +01:00
Add support for clips
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user