Save the tab param to the URL at runtime

This commit is contained in:
Bnyro 2023-01-26 19:43:07 +01:00
parent d7ba61ebbc
commit 7f72485a04
2 changed files with 15 additions and 0 deletions

View File

@ -224,10 +224,13 @@ export default {
},
loadTab(index) {
this.selectedTab = index;
this.appendQueryToUrl("tab", this.tabs[index].name ?? "videos");
if (index == 0) {
this.contentItems = this.channel.relatedStreams;
return;
}
if (this.tabs[index].content) {
this.contentItems = this.tabs[index].content;
return;

View File

@ -251,6 +251,18 @@ const mixin = {
elem.click();
elem.remove();
},
appendQueryToUrl(key, value) {
let searchParams = new URLSearchParams(window.location.search);
searchParams.set(key, value);
let newurl =
window.location.protocol +
"//" +
window.location.host +
window.location.pathname +
"?" +
searchParams.toString();
window.history.pushState({ path: newurl }, "", newurl);
},
},
computed: {
authenticated(_this) {