diff options
Diffstat (limited to 'client/src/app/videos/video-list')
3 files changed, 16 insertions, 9 deletions
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts index 3020b8c30..f150e38da 100644 --- a/client/src/app/videos/video-list/video-recently-added.component.ts +++ b/client/src/app/videos/video-list/video-recently-added.component.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | ||
3 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
4 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
5 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
@@ -28,7 +29,9 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
28 | super.ngOnInit() | 29 | super.ngOnInit() |
29 | } | 30 | } |
30 | 31 | ||
31 | getVideosObservable () { | 32 | getVideosObservable (page: number) { |
32 | return this.videoService.getVideos(this.pagination, this.sort) | 33 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
34 | |||
35 | return this.videoService.getVideos(newPagination, this.sort) | ||
33 | } | 36 | } |
34 | } | 37 | } |
diff --git a/client/src/app/videos/video-list/video-search.component.ts b/client/src/app/videos/video-list/video-search.component.ts index 67726afdc..241b97bc7 100644 --- a/client/src/app/videos/video-list/video-search.component.ts +++ b/client/src/app/videos/video-list/video-search.component.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | ||
3 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
4 | import { Subscription } from 'rxjs/Subscription' | 5 | import { Subscription } from 'rxjs/Subscription' |
5 | import { AuthService } from '../../core/auth' | 6 | import { AuthService } from '../../core/auth' |
@@ -16,7 +17,7 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O | |||
16 | currentRoute = '/videos/search' | 17 | currentRoute = '/videos/search' |
17 | loadOnInit = false | 18 | loadOnInit = false |
18 | 19 | ||
19 | protected otherParams = { | 20 | protected otherRouteParams = { |
20 | search: '' | 21 | search: '' |
21 | } | 22 | } |
22 | private subActivatedRoute: Subscription | 23 | private subActivatedRoute: Subscription |
@@ -35,9 +36,9 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O | |||
35 | this.subActivatedRoute = this.route.queryParams.subscribe( | 36 | this.subActivatedRoute = this.route.queryParams.subscribe( |
36 | queryParams => { | 37 | queryParams => { |
37 | const querySearch = queryParams['search'] | 38 | const querySearch = queryParams['search'] |
38 | if (!querySearch || this.otherParams.search === querySearch) return | 39 | if (!querySearch || this.otherRouteParams.search === querySearch) return |
39 | 40 | ||
40 | this.otherParams.search = querySearch | 41 | this.otherRouteParams.search = querySearch |
41 | this.reloadVideos() | 42 | this.reloadVideos() |
42 | }, | 43 | }, |
43 | 44 | ||
@@ -51,7 +52,8 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O | |||
51 | } | 52 | } |
52 | } | 53 | } |
53 | 54 | ||
54 | getVideosObservable () { | 55 | getVideosObservable (page: number) { |
55 | return this.videoService.searchVideos(this.otherParams.search, this.pagination, this.sort) | 56 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
57 | return this.videoService.searchVideos(this.otherRouteParams.search, newPagination, this.sort) | ||
56 | } | 58 | } |
57 | } | 59 | } |
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index fc48086d6..a42457273 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | ||
3 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
4 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
5 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
@@ -28,7 +29,8 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit | |||
28 | super.ngOnInit() | 29 | super.ngOnInit() |
29 | } | 30 | } |
30 | 31 | ||
31 | getVideosObservable () { | 32 | getVideosObservable (page: number) { |
32 | return this.videoService.getVideos(this.pagination, this.sort) | 33 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
34 | return this.videoService.getVideos(newPagination, this.sort) | ||
33 | } | 35 | } |
34 | } | 36 | } |