From fcab0c9499de66ebbf6179d6fd2dc6e95576748a Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Sat, 29 May 2021 00:10:54 +0530 Subject: [PATCH] Add support for /c/ and /user/ --- src/components/Channel.vue | 11 +++++++++-- src/router/router.js | 12 +++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/Channel.vue b/src/components/Channel.vue index 18356163..ba904bf9 100644 --- a/src/components/Channel.vue +++ b/src/components/Channel.vue @@ -51,7 +51,14 @@ export default { }, methods: { 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() { this.fetchChannel() @@ -65,7 +72,7 @@ export default { this.fetchJson( Constants.BASE_URL + "/nextpage/channels/" + - this.$route.params.channelId + + this.channel.id + "?url=" + encodeURIComponent(this.channel.nextpage) + "&id=" + diff --git a/src/router/router.js b/src/router/router.js index 1a5b8066..1b84869f 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -13,7 +13,17 @@ const routes = [ }, { 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"), }, {