import { AuthService, Notifier, RedirectService } from '@app/core'
import { User, UserRight } from '../../../../shared'
import { I18n } from '@ngx-translate/i18n-polyfill'
+import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
+import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
@Component({
templateUrl: './accounts.component.html',
export class AccountsComponent implements OnInit, OnDestroy {
account: Account
user: User
+ videoChannels: VideoChannel[]
private routeSub: Subscription
private route: ActivatedRoute,
private userService: UserService,
private accountService: AccountService,
+ private videoChannelService: VideoChannelService,
private notifier: Notifier,
private restExtractor: RestExtractor,
private redirectService: RedirectService,
- private authService: AuthService
+ private authService: AuthService,
+ private i18n: I18n
) {}
ngOnInit () {
catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))
)
.subscribe(
- account => this.account = account,
+ account => {
+ this.account = account
+ this.videoChannelService.listAccountVideoChannels(account)
+ .subscribe(videoChannels => this.videoChannels = videoChannels.data)
+ },
err => this.notifier.error(err.message)
)
this.redirectService.redirectToHomepage()
}
+ activateCopiedMessage () {
+ this.notifier.success(this.i18n('Username copied'))
+ }
+
private getUserIfNeeded (account: Account) {
if (!account.userId) return
if (!this.authService.isLoggedIn()) return