diff --git a/NUXT/store/channel/index.js b/NUXT/store/channel/index.js index 4a8f203..7431475 100644 --- a/NUXT/store/channel/index.js +++ b/NUXT/store/channel/index.js @@ -18,19 +18,20 @@ export const actions = { `%c${channelUrl}`, "color: black; font-weight: bold; background: #0f0; padding: .5rem .25rem; border-radius: .25rem;" ); + console.log(channelUrl.substring(channelUrl.lastIndexOf("/") + 1)); // substring removes /channel/ from the url if called from watch page, but keeps string intact if called from search page this.$youtube .getChannel( `https://youtube.com/channel/${channelUrl.substring( - channelUrl.indexOf("/") + channelUrl.lastIndexOf("/") + 1 )}` ) .then((channel) => { // console.log(channel); state.banner = - channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelBanner.image.sources[0].url; + channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelBanner?.image.sources[0].url; state.avatar = - channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.avatarData.avatar.image.sources[0].url; + channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.avatarData.avatar?.image.sources[0].url; state.title = channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.title; state.subscribe = @@ -45,7 +46,7 @@ export const actions = { channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.metadata.videosCountText; }) .catch((err) => { - console.log(err); + console.error(err); }); }, }; diff --git a/NUXT/store/tweaks/index.js b/NUXT/store/tweaks/index.js index bc961a5..6da6454 100644 --- a/NUXT/store/tweaks/index.js +++ b/NUXT/store/tweaks/index.js @@ -1,16 +1,18 @@ export const state = () => ({ roundTweak: 0, - roundThumb: true, - roundWatch: true, + roundThumb: null, + roundWatch: null, }); export const mutations = { initTweaks(state) { // NOTE: localStorage is not reactive, so it will only be used on first load - // currently called beforeCreate() in pages/default.vue + // currently called on mounted() in pages/index.vue if (process.client) { state.roundTweak = localStorage.getItem("roundTweak") || 0; - state.roundThumb = localStorage.getItem("roundThumb") || true; - state.roundWatch = localStorage.getItem("roundWatch") || true; + state.roundThumb = localStorage.getItem("roundThumb"); + state.roundWatch = localStorage.getItem("roundWatch"); + console.log(state.roundThumb); + console.log(state.roundWatch); } }, setRoundTweak(state, payload) {