mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-22 13:37:23 +00:00
Routing cleanup and improvement (#227)
This commit is contained in:
parent
1dc5450223
commit
17ea593bb0
@ -40,13 +40,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchChannel() {
|
async fetchChannel() {
|
||||||
const url =
|
const url =
|
||||||
Constants.BASE_URL +
|
Constants.BASE_URL + "/"
|
||||||
(this.$route.params.channelId
|
+ this.$route.params.path + "/"
|
||||||
? "/channels/" + this.$route.params.channelId
|
+ this.$route.params.channelId
|
||||||
: this.$route.params.channelC
|
|
||||||
? "/c/" + this.$route.params.channelC
|
|
||||||
: "/user/" + this.$route.params.channelUser);
|
|
||||||
return await this.fetchJson(url);
|
return await this.fetchJson(url);
|
||||||
},
|
},
|
||||||
async getChannelData() {
|
async getChannelData() {
|
||||||
@ -60,7 +57,7 @@ export default {
|
|||||||
if (this.loading || !this.channel || !this.channel.nextpage) return;
|
if (this.loading || !this.channel || !this.channel.nextpage) return;
|
||||||
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
|
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.fetchJson(Constants.BASE_URL + "/nextpage/channels/" + this.channel.id, {
|
this.fetchJson(Constants.BASE_URL + "/nextpage/channel/" + this.channel.id, {
|
||||||
nextpage: this.channel.nextpage,
|
nextpage: this.channel.nextpage,
|
||||||
}).then(json => {
|
}).then(json => {
|
||||||
this.channel.relatedStreams.concat(json.relatedStreams);
|
this.channel.relatedStreams.concat(json.relatedStreams);
|
||||||
|
@ -1,50 +1,11 @@
|
|||||||
import { createRouter, createWebHistory } from "vue-router";
|
import { createRouter, createWebHistory } from "vue-router";
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
|
||||||
path: "/watch",
|
|
||||||
component: () => import("../components/WatchVideo.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/watch/:v",
|
|
||||||
component: () => import("../components/WatchVideo.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/embed/:v",
|
|
||||||
component: () => import("../components/WatchVideo.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/w/:v",
|
|
||||||
component: () => import("../components/WatchVideo.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/v/:v",
|
|
||||||
component: () => import("../components/WatchVideo.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/shorts/:v",
|
|
||||||
component: () => import("../components/WatchVideo.vue"),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
name: "Trending",
|
name: "Trending",
|
||||||
component: () => import("../components/TrendingPage.vue"),
|
component: () => import("../components/TrendingPage.vue"),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "/channel/:channelId",
|
|
||||||
name: "ChannelId",
|
|
||||||
component: () => import("../components/Channel.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/c/:channelC",
|
|
||||||
name: "ChannelC",
|
|
||||||
component: () => import("../components/Channel.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/user/:channelUser",
|
|
||||||
name: "ChannelUser",
|
|
||||||
component: () => import("../components/Channel.vue"),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/preferences",
|
path: "/preferences",
|
||||||
name: "Preferences",
|
name: "Preferences",
|
||||||
@ -60,6 +21,14 @@ const routes = [
|
|||||||
name: "Playlist",
|
name: "Playlist",
|
||||||
component: () => import("../components/Playlist.vue"),
|
component: () => import("../components/Playlist.vue"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/:path(v|w|embed|shorts|watch)/:v?",
|
||||||
|
component: () => import("../components/WatchVideo.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/:path(channel|user|c)/:channelId/:videos?",
|
||||||
|
component: () => import("../components/Channel.vue"),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
Loading…
Reference in New Issue
Block a user