diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-01 17:39:09 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-01 17:39:09 +0200 |
commit | 478796690075a8868bf39a33f3ead80cf0040f42 (patch) | |
tree | 94fbe7906f2181420b88ede34ff7f3e6deec7d0b | |
parent | c2ad546df93717833cba15aa7283863c80c07a66 (diff) | |
download | PeerTube-478796690075a8868bf39a33f3ead80cf0040f42.tar.gz PeerTube-478796690075a8868bf39a33f3ead80cf0040f42.tar.zst PeerTube-478796690075a8868bf39a33f3ead80cf0040f42.zip |
Don't throw an error on empty search
-rw-r--r-- | client/src/app/search/search.component.ts | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts index b86b5083a..911d56843 100644 --- a/client/src/app/search/search.component.ts +++ b/client/src/app/search/search.component.ts | |||
@@ -51,15 +51,12 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
51 | queryParams => { | 51 | queryParams => { |
52 | const querySearch = queryParams['search'] | 52 | const querySearch = queryParams['search'] |
53 | 53 | ||
54 | // New empty search | ||
55 | if (this.currentSearch && !querySearch) return this.redirectService.redirectToHomepage() | ||
56 | |||
57 | // Search updated, reset filters | 54 | // Search updated, reset filters |
58 | if (this.currentSearch !== querySearch) { | 55 | if (this.currentSearch !== querySearch) { |
59 | this.resetPagination() | 56 | this.resetPagination() |
60 | this.advancedSearch.reset() | 57 | this.advancedSearch.reset() |
61 | 58 | ||
62 | this.currentSearch = querySearch | 59 | this.currentSearch = querySearch || undefined |
63 | this.updateTitle() | 60 | this.updateTitle() |
64 | } | 61 | } |
65 | 62 | ||
@@ -154,7 +151,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
154 | } | 151 | } |
155 | 152 | ||
156 | private updateUrlFromAdvancedSearch () { | 153 | private updateUrlFromAdvancedSearch () { |
157 | const search = (this.currentSearch && this.currentSearch !== '') ? this.currentSearch : undefined | 154 | const search = this.currentSearch || undefined |
158 | 155 | ||
159 | this.router.navigate([], { | 156 | this.router.navigate([], { |
160 | relativeTo: this.route, | 157 | relativeTo: this.route, |