]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/videos/+video-edit/video-add.component.ts
Correctly handle video import errors
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-edit / video-add.component.ts
... / ...
CommitLineData
1import { Component, ViewChild } from '@angular/core'
2import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
3import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component'
4import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
5
6@Component({
7 selector: 'my-videos-add',
8 templateUrl: './video-add.component.html',
9 styleUrls: [ './video-add.component.scss' ]
10})
11export class VideoAddComponent implements CanComponentDeactivate {
12 @ViewChild('videoUpload') videoUpload: VideoUploadComponent
13 @ViewChild('videoImport') videoImport: VideoImportComponent
14
15 secondStepType: 'upload' | 'import'
16 videoName: string
17
18 onFirstStepDone (type: 'upload' | 'import', videoName: string) {
19 this.secondStepType = type
20 this.videoName = videoName
21 }
22
23 canDeactivate () {
24 if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
25 if (this.secondStepType === 'import') return this.videoImport.canDeactivate()
26
27 return { canDeactivate: true }
28 }
29}