1 import { minBy } from 'lodash-es'
2 import { first, map } from 'rxjs/operators'
3 import { SelectChannelItem } from 'src/types/select-options-item.model'
4 import { AuthService } from '../../core/auth'
6 function listUserChannelsForSelect (authService: AuthService) {
7 return authService.userInformationLoaded
11 const user = authService.getUser()
12 if (!user) return undefined
14 const videoChannels = user.videoChannels
15 if (Array.isArray(videoChannels) === false) return undefined
19 if (a.updatedAt < b.updatedAt) return 1
20 if (a.updatedAt > b.updatedAt) return -1
27 avatarPath: minBy(c.avatars, 'width')[0]?.path
28 }) as SelectChannelItem)
34 listUserChannelsForSelect