import { of } from 'rxjs'
import { switchMap } from 'rxjs/operators'
-import { Component, OnInit } from '@angular/core'
+import { AfterViewInit, Component, OnInit } from '@angular/core'
import { Router } from '@angular/router'
-import { AuthService, Notifier } from '@app/core'
+import { AuthService, HooksService, Notifier } from '@app/core'
import {
VIDEO_CHANNEL_DESCRIPTION_VALIDATOR,
VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR,
VIDEO_CHANNEL_NAME_VALIDATOR,
VIDEO_CHANNEL_SUPPORT_VALIDATOR
} from '@app/shared/form-validators/video-channel-validators'
-import { FormValidatorService } from '@app/shared/shared-forms'
+import { FormReactiveService } from '@app/shared/shared-forms'
import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'
import { HttpStatusCode, VideoChannelCreate } from '@shared/models'
import { VideoChannelEdit } from './video-channel-edit'
templateUrl: './video-channel-edit.component.html',
styleUrls: [ './video-channel-edit.component.scss' ]
})
-export class VideoChannelCreateComponent extends VideoChannelEdit implements OnInit {
+export class VideoChannelCreateComponent extends VideoChannelEdit implements OnInit, AfterViewInit {
error: string
videoChannel = new VideoChannel({})
private banner: FormData
constructor (
- protected formValidatorService: FormValidatorService,
+ protected formReactiveService: FormReactiveService,
private authService: AuthService,
private notifier: Notifier,
private router: Router,
- private videoChannelService: VideoChannelService
+ private videoChannelService: VideoChannelService,
+ private hooks: HooksService
) {
super()
}
ngOnInit () {
this.buildForm({
- name: VIDEO_CHANNEL_NAME_VALIDATOR,
+ 'name': VIDEO_CHANNEL_NAME_VALIDATOR,
'display-name': VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR,
- description: VIDEO_CHANNEL_DESCRIPTION_VALIDATOR,
- support: VIDEO_CHANNEL_SUPPORT_VALIDATOR
+ 'description': VIDEO_CHANNEL_DESCRIPTION_VALIDATOR,
+ 'support': VIDEO_CHANNEL_SUPPORT_VALIDATOR
})
}
+ ngAfterViewInit () {
+ this.hooks.runAction('action:video-channel-create.init', 'video-channel')
+ }
+
formValidated () {
this.error = undefined