import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig } from '@shared/models'
import { UserService } from '@app/shared'
+import { SearchTargetType } from '@shared/models/search/search-target-query.model'
@Component({
selector: 'my-search',
private channelsPerPage = 2
+ private lastSearchTarget: SearchTargetType
+
constructor (
private i18n: I18n,
private route: ActivatedRoute,
this.subActivatedRoute = this.route.queryParams.subscribe(
async queryParams => {
const querySearch = queryParams['search']
+ const searchTarget = queryParams['searchTarget']
// Search updated, reset filters
- if (this.currentSearch !== querySearch) {
+ if (this.currentSearch !== querySearch || searchTarget !== this.advancedSearch.searchTarget) {
this.resetPagination()
this.advancedSearch.reset()
.concat(videosResult.data)
this.pagination.totalItems = videosResult.total + videoChannelsResult.total
+ this.lastSearchTarget = this.advancedSearch.searchTarget
// Focus on channels if there are no enough videos
if (this.firstSearch === true && videosResult.data.length < this.pagination.itemsPerPage) {
}
hideActions () {
- return this.advancedSearch.searchTarget === 'search-index'
+ return this.lastSearchTarget === 'search-index'
}
private resetPagination () {