protected storageService: LocalStorageService,
protected cfr: ComponentFactoryResolver,
private videoService: VideoService,
+ private redirectService: RedirectService,
private hooks: HooksService
) {
super()
- this.defaultSort = this.parseAlgorithm(RedirectService.DEFAULT_TRENDING_ALGORITHM)
+ this.defaultSort = this.parseAlgorithm(this.redirectService.getDefaultTrendingAlgorithm())
this.headerComponentInjector = this.getInjector()
}
if (oldSort !== this.sort) this.reloadVideos()
}
- )
+ )
}
ngOnDestroy () {
getInjector () {
return Injector.create({
- providers: [{
+ providers: [ {
provide: 'data',
useValue: {
model: this.defaultSort
}
- }]
+ } ]
})
}
protected loadPageRouteParams (queryParams: Params) {
- const algorithm = queryParams['alg'] || RedirectService.DEFAULT_TRENDING_ALGORITHM
+ const algorithm = queryParams['alg'] || this.redirectService.getDefaultTrendingAlgorithm()
this.sort = this.parseAlgorithm(algorithm)
}
switch (algorithm) {
case 'most-viewed':
return '-trending'
+
case 'most-liked':
return '-likes'
+
default:
return '-' + algorithm as VideoSortField
}