]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/header/search-typeahead.component.ts
inject lang in document to match current locale
[github/Chocobozzz/PeerTube.git] / client / src / app / header / search-typeahead.component.ts
index d0350368dab790bd80ff089e1b84a32ae0b101e4..2bf1072f443b1ce9752e80b0e5292e818a5fd56e 100644 (file)
@@ -36,7 +36,7 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
 
   ngOnInit () {
     this.route.queryParams
-      .pipe(first(params => params.search !== undefined && params.search !== null))
+      .pipe(first(params => this.isOnSearch() && params.search !== undefined && params.search !== null))
       .subscribe(params => this.search = params.search)
     this.serverService.getConfig()
       .subscribe(config => this.serverConfig = config)
@@ -146,11 +146,15 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
     }
   }
 
+  isOnSearch () {
+    return window.location.pathname === '/search'
+  }
+
   doSearch () {
     this.newSearch = false
     const queryParams: Params = {}
 
-    if (window.location.pathname === '/search' && this.route.snapshot.queryParams) {
+    if (this.isOnSearch() && this.route.snapshot.queryParams) {
       Object.assign(queryParams, this.route.snapshot.queryParams)
     }