mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-10 10:18:23 +00:00
Use replaceState
and simplify updating search params
This commit is contained in:
parent
7f72485a04
commit
3ecb0f668e
@ -224,7 +224,11 @@ export default {
|
|||||||
},
|
},
|
||||||
loadTab(index) {
|
loadTab(index) {
|
||||||
this.selectedTab = index;
|
this.selectedTab = index;
|
||||||
this.appendQueryToUrl("tab", this.tabs[index].name ?? "videos");
|
|
||||||
|
// update the tab query in the url path
|
||||||
|
const url = new URL(window.location);
|
||||||
|
url.searchParams.set("tab", this.tabs[index].name ?? "videos");
|
||||||
|
window.history.replaceState(window.history.state, "", url);
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
this.contentItems = this.channel.relatedStreams;
|
this.contentItems = this.channel.relatedStreams;
|
||||||
|
12
src/main.js
12
src/main.js
@ -251,18 +251,6 @@ const mixin = {
|
|||||||
elem.click();
|
elem.click();
|
||||||
elem.remove();
|
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: {
|
computed: {
|
||||||
authenticated(_this) {
|
authenticated(_this) {
|
||||||
|
Loading…
Reference in New Issue
Block a user