aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+search/shared/channel-lazy-load.resolver.ts
blob: 5e010f795b3b98b68e79b3f24c07e5e3d991d7b6 (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 { VideoChannel } from '@app/shared/shared-main'
import { SearchService } from '@app/shared/shared-search'
import { AbstractLazyLoadResolver } from './abstract-lazy-load.resolver'

@Injectable()
export class ChannelLazyLoadResolver extends AbstractLazyLoadResolver<VideoChannel> {

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

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

  protected buildUrl (channel: VideoChannel) {
    return '/video-channels/' + channel.nameWithHost
  }
}