mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	Save the tab param to the URL at runtime
This commit is contained in:
		
							parent
							
								
									d7ba61ebbc
								
							
						
					
					
						commit
						7f72485a04
					
				
					 2 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								src/main.js
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/main.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue