mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-11-23 03:35:15 +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}`,
|
`%c${channelUrl}`,
|
||||||
"color: black; font-weight: bold; background: #0f0; padding: .5rem .25rem; border-radius: .25rem;"
|
"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
|
// substring removes /channel/ from the url if called from watch page, but keeps string intact if called from search page
|
||||||
this.$youtube
|
this.$youtube
|
||||||
.getChannel(
|
.getChannel(
|
||||||
`https://youtube.com/channel/${channelUrl.substring(
|
`https://youtube.com/channel/${channelUrl.substring(
|
||||||
channelUrl.indexOf("/")
|
channelUrl.lastIndexOf("/") + 1
|
||||||
)}`
|
)}`
|
||||||
)
|
)
|
||||||
.then((channel) => {
|
.then((channel) => {
|
||||||
// console.log(channel);
|
// console.log(channel);
|
||||||
state.banner =
|
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 =
|
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 =
|
state.title =
|
||||||
channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.title;
|
channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.title;
|
||||||
state.subscribe =
|
state.subscribe =
|
||||||
|
@ -45,7 +46,7 @@ export const actions = {
|
||||||
channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.metadata.videosCountText;
|
channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.metadata.videosCountText;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
export const state = () => ({
|
export const state = () => ({
|
||||||
roundTweak: 0,
|
roundTweak: 0,
|
||||||
roundThumb: true,
|
roundThumb: null,
|
||||||
roundWatch: true,
|
roundWatch: null,
|
||||||
});
|
});
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
initTweaks(state) {
|
initTweaks(state) {
|
||||||
// NOTE: localStorage is not reactive, so it will only be used on first load
|
// 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) {
|
if (process.client) {
|
||||||
state.roundTweak = localStorage.getItem("roundTweak") || 0;
|
state.roundTweak = localStorage.getItem("roundTweak") || 0;
|
||||||
state.roundThumb = localStorage.getItem("roundThumb") || true;
|
state.roundThumb = localStorage.getItem("roundThumb");
|
||||||
state.roundWatch = localStorage.getItem("roundWatch") || true;
|
state.roundWatch = localStorage.getItem("roundWatch");
|
||||||
|
console.log(state.roundThumb);
|
||||||
|
console.log(state.roundWatch);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setRoundTweak(state, payload) {
|
setRoundTweak(state, payload) {
|
||||||
|
|
Loading…
Reference in a new issue