]> Untitled Git - lemmy-ui.git/blobdiff - src/shared/components/app/navbar.tsx
Make pages use query params instead of route params where appropriate (#977)
[lemmy-ui.git] / src / shared / components / app / navbar.tsx
index 4d0b88fdc2d5893986f7d30516aefbb6bae69389..44345cc9311655e2923c56055e00f0eae73505bc 100644 (file)
@@ -43,7 +43,6 @@ interface NavbarState {
   unreadInboxCount: number;
   unreadReportCount: number;
   unreadApplicationCount: number;
-  searchParam: string;
   showDropdown: boolean;
   onSiteBanner?(url: string): any;
 }
@@ -59,7 +58,6 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
     unreadReportCount: 0,
     unreadApplicationCount: 0,
     expanded: false,
-    searchParam: "",
     showDropdown: false,
   };
   subscription: any;
@@ -115,20 +113,6 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
     this.unreadApplicationCountSub.unsubscribe();
   }
 
-  updateUrl() {
-    const searchParam = this.state.searchParam;
-    this.setState({ searchParam: "" });
-    this.setState({ showDropdown: false, expanded: false });
-    if (searchParam === "") {
-      this.context.router.history.push(`/search/`);
-    } else {
-      const searchParamEncoded = encodeURIComponent(searchParam);
-      this.context.router.history.push(
-        `/search/q/${searchParamEncoded}/type/All/sort/TopAll/listing_type/All/community_id/0/creator_id/0/page/1`
-      );
-    }
-  }
-
   render() {
     return this.navbar();
   }
@@ -488,10 +472,6 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
     i.setState({ expanded: false, showDropdown: false });
   }
 
-  handleSearchParam(i: Navbar, event: any) {
-    i.setState({ searchParam: event.target.value });
-  }
-
   handleLogoutClick(i: Navbar) {
     i.setState({ showDropdown: false, expanded: false });
     UserService.Instance.logout();