aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+search/shared/video-lazy-load.resolver.ts
blob: 69a3eb159af9b234047416ae667f0d9c4c1fe567 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Injectable } from '@angular/core'
import { Router } from '@angular/router'
import { Video } from '@app/shared/shared-main'
import { SearchService } from '@app/shared/shared-search'
import { AbstractLazyLoadResolver } from './abstract-lazy-load.resolver'

@Injectable()
export class VideoLazyLoadResolver extends AbstractLazyLoadResolver<Video> {

  constructor (
    protected router: Router,
    private searchService: SearchService
  ) {
    super()
  }

  protected finder (url: string) {
    return this.searchService.searchVideos({ search: url })
  }

  protected buildUrl (video: Video) {
    return Video.buildWatchUrl(video)
  }
}