Add support for /c/ and /user/

This commit is contained in:
FireMasterK 2021-05-29 00:10:54 +05:30
parent c6cc796ea9
commit fcab0c9499
No known key found for this signature in database
GPG Key ID: 8DFF5DD33E93DB58
2 changed files with 20 additions and 3 deletions

View File

@ -51,7 +51,14 @@ export default {
}, },
methods: { methods: {
async fetchChannel() { async fetchChannel() {
return await this.fetchJson(Constants.BASE_URL + "/channels/" + this.$route.params.channelId); const url =
Constants.BASE_URL +
(this.$route.params.channelId
? "/channels/" + this.$route.params.channelId
: this.$route.params.channelC
? "/c/" + this.$route.params.channelC
: "/user/" + this.$route.params.channelUser);
return await this.fetchJson(url);
}, },
async getChannelData() { async getChannelData() {
this.fetchChannel() this.fetchChannel()
@ -65,7 +72,7 @@ export default {
this.fetchJson( this.fetchJson(
Constants.BASE_URL + Constants.BASE_URL +
"/nextpage/channels/" + "/nextpage/channels/" +
this.$route.params.channelId + this.channel.id +
"?url=" + "?url=" +
encodeURIComponent(this.channel.nextpage) + encodeURIComponent(this.channel.nextpage) +
"&id=" + "&id=" +

View File

@ -13,7 +13,17 @@ const routes = [
}, },
{ {
path: "/channel/:channelId", path: "/channel/:channelId",
name: "Channel", 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"), component: () => import("../components/Channel.vue"),
}, },
{ {