aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/channels.ts
blob: a77543c92e2c91e04c3207d5727cdafdc6038d0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { User } from '../../models/users/user.model'
import { ServerInfo } from '../server/servers'
import { getMyUserInformation } from '../users/users'

function setDefaultVideoChannel (servers: ServerInfo[]) {
  const tasks: Promise<any>[] = []

  for (const server of servers) {
    const p = getMyUserInformation(server.url, server.accessToken)
      .then(res => { server.videoChannel = (res.body as User).videoChannels[0] })

    tasks.push(p)
  }

  return Promise.all(tasks)
}

export {
  setDefaultVideoChannel
}