mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-11-22 19:25:16 +00:00
tweak cache bugfix, channel load from watch page bugfix
This commit is contained in:
parent
3b72897657
commit
96093241c0
2 changed files with 12 additions and 9 deletions
|
@ -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);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue