import { Component, OnDestroy, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
-import { AuthService, RedirectService } from '@app/core'
-import { NotificationsService } from 'angular2-notifications'
+import { AuthService, Notifier } from '@app/core'
import { forkJoin, Subscription } from 'rxjs'
import { SearchService } from '@app/search/search.service'
import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
private route: ActivatedRoute,
private router: Router,
private metaService: MetaService,
- private redirectService: RedirectService,
- private notificationsService: NotificationsService,
+ private notifier: Notifier,
private searchService: SearchService,
private authService: AuthService
) { }
+ get user () {
+ return this.authService.getUser()
+ }
+
ngOnInit () {
this.subActivatedRoute = this.route.queryParams.subscribe(
queryParams => {
this.search()
},
- err => this.notificationsService.error('Error', err.text)
+ err => this.notifier.error(err.text)
)
}
this.firstSearch = false
},
- error => {
- this.notificationsService.error(this.i18n('Error'), error.message)
- }
+ err => this.notifier.error(err.message)
)
}
return this.advancedSearch.size()
}
+ removeVideoFromArray (video: Video) {
+ this.results = this.results.filter(r => !this.isVideo(r) || r.id !== video.id)
+ }
+
private resetPagination () {
this.pagination.currentPage = 1
this.pagination.totalItems = null
}
private updateTitle () {
- this.metaService.setTitle(this.i18n('Search') + ' ' + this.currentSearch)
+ const suffix = this.currentSearch ? ' ' + this.currentSearch : ''
+ this.metaService.setTitle(this.i18n('Search') + suffix)
}
private updateUrlFromAdvancedSearch () {