Fix video update

pull/4107/head
Chocobozzz 2021-05-10 15:48:10 +02:00
parent ff0497fee8
commit 1fa23d6f5e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 22 additions and 19 deletions

View File

@ -1,4 +1,4 @@
import { map } from 'rxjs/operators' import { first, map } from 'rxjs/operators'
import { SelectChannelItem } from 'src/types/select-options-item.model' import { SelectChannelItem } from 'src/types/select-options-item.model'
import { DatePipe } from '@angular/common' import { DatePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http' import { HttpErrorResponse } from '@angular/common/http'
@ -23,26 +23,29 @@ function getParameterByName (name: string, url: string) {
function listUserChannels (authService: AuthService) { function listUserChannels (authService: AuthService) {
return authService.userInformationLoaded return authService.userInformationLoaded
.pipe(map(() => { .pipe(
const user = authService.getUser() first(),
if (!user) return undefined map(() => {
const user = authService.getUser()
if (!user) return undefined
const videoChannels = user.videoChannels const videoChannels = user.videoChannels
if (Array.isArray(videoChannels) === false) return undefined if (Array.isArray(videoChannels) === false) return undefined
return videoChannels return videoChannels
.sort((a, b) => { .sort((a, b) => {
if (a.updatedAt < b.updatedAt) return 1 if (a.updatedAt < b.updatedAt) return 1
if (a.updatedAt > b.updatedAt) return -1 if (a.updatedAt > b.updatedAt) return -1
return 0 return 0
}) })
.map(c => ({ .map(c => ({
id: c.id, id: c.id,
label: c.displayName, label: c.displayName,
support: c.support, support: c.support,
avatarPath: c.avatar?.path avatarPath: c.avatar?.path
}) as SelectChannelItem) }) as SelectChannelItem)
})) })
)
} }
function getAbsoluteAPIUrl () { function getAbsoluteAPIUrl () {