From 90931d728649fb226e83cf3d6d13d09fb47d589d Mon Sep 17 00:00:00 2001 From: Georgiy Date: Fri, 26 May 2023 18:45:54 +0300 Subject: [PATCH] refactor(channelRequest): Added new type of channel url - /@examplechannel. --- NUXT/store/channel/index.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/NUXT/store/channel/index.js b/NUXT/store/channel/index.js index 0f8c640..13e7e33 100644 --- a/NUXT/store/channel/index.js +++ b/NUXT/store/channel/index.js @@ -6,7 +6,7 @@ const getDefaultState = () => { banner: null, title: null, subscribe: null, - subscribeAlt: null, + subscribeAlt: "", descriptionPreview: null, subscribers: null, videosCount: null, @@ -22,12 +22,18 @@ export const actions = { Object.assign(state, getDefaultState()); state.loading = true; console.log(channelUrl); - const channelRequest = + let channelRequest = ""; + console.warn(channelUrl); + if ( channelUrl.includes("/c/") || channelUrl.includes("/user/") || - channelUrl.includes("/channel/") - ? `https://youtube.com/${channelUrl}` - : `https://youtube.com/channel/${channelUrl}`; + channelUrl.includes("/channel/") || + channelUrl.includes("/@") + ) { + channelRequest = `https://youtube.com/${channelUrl}`; + } else { + channelRequest = `https://youtube.com/channel/${channelUrl}`; + } this.$youtube .getChannel(channelRequest) .then((channel) => {