diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 11:27:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-17 14:01:45 +0200 |
commit | 1378c0d343028f3d40d7d795422684ab9e6a1599 (patch) | |
tree | 08062b84a38a7e2dfe0aa674e7ca8e1b7321044e /client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | |
parent | c186a67f90203af6bfa434f026efdc99193bcd65 (diff) | |
download | PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.tar.gz PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.tar.zst PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.zip |
Fix client lint
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts index db25dc6be..30c79594d 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | |||
@@ -8,7 +8,7 @@ import { FormValidatorService } from '@app/shared/shared-forms' | |||
8 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 8 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
9 | import { LiveVideoService } from '@app/shared/shared-video-live' | 9 | import { LiveVideoService } from '@app/shared/shared-video-live' |
10 | import { LoadingBarService } from '@ngx-loading-bar/core' | 10 | import { LoadingBarService } from '@ngx-loading-bar/core' |
11 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode, VideoPrivacy } from '@shared/models' | 11 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' |
12 | import { VideoSend } from './video-send' | 12 | import { VideoSend } from './video-send' |
13 | 13 | ||
14 | @Component({ | 14 | @Component({ |
@@ -74,33 +74,34 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
74 | const toPatch = Object.assign({}, video, { privacy: this.firstStepPrivacyId }) | 74 | const toPatch = Object.assign({}, video, { privacy: this.firstStepPrivacyId }) |
75 | this.form.patchValue(toPatch) | 75 | this.form.patchValue(toPatch) |
76 | 76 | ||
77 | this.liveVideoService.goLive(video).subscribe( | 77 | this.liveVideoService.goLive(video) |
78 | res => { | 78 | .subscribe({ |
79 | this.videoId = res.video.id | 79 | next: res => { |
80 | this.videoUUID = res.video.uuid | 80 | this.videoId = res.video.id |
81 | this.isInUpdateForm = true | 81 | this.videoUUID = res.video.uuid |
82 | this.isInUpdateForm = true | ||
82 | 83 | ||
83 | this.firstStepDone.emit(name) | 84 | this.firstStepDone.emit(name) |
84 | 85 | ||
85 | this.fetchVideoLive() | 86 | this.fetchVideoLive() |
86 | }, | 87 | }, |
88 | |||
89 | error: err => { | ||
90 | this.firstStepError.emit() | ||
87 | 91 | ||
88 | err => { | 92 | let message = err.message |
89 | this.firstStepError.emit() | ||
90 | 93 | ||
91 | let message = err.message | 94 | const error = err.body as PeerTubeProblemDocument |
92 | 95 | ||
93 | const error = err.body as PeerTubeProblemDocument | 96 | if (error?.code === ServerErrorCode.MAX_INSTANCE_LIVES_LIMIT_REACHED) { |
97 | message = $localize`Cannot create live because this instance have too many created lives` | ||
98 | } else if (error?.code === ServerErrorCode.MAX_USER_LIVES_LIMIT_REACHED) { | ||
99 | message = $localize`Cannot create live because you created too many lives` | ||
100 | } | ||
94 | 101 | ||
95 | if (error?.code === ServerErrorCode.MAX_INSTANCE_LIVES_LIMIT_REACHED) { | 102 | this.notifier.error(message) |
96 | message = $localize`Cannot create live because this instance have too many created lives` | ||
97 | } else if (error?.code === ServerErrorCode.MAX_USER_LIVES_LIMIT_REACHED) { | ||
98 | message = $localize`Cannot create live because you created too many lives` | ||
99 | } | 103 | } |
100 | 104 | }) | |
101 | this.notifier.error(message) | ||
102 | } | ||
103 | ) | ||
104 | } | 105 | } |
105 | 106 | ||
106 | updateSecondStep () { | 107 | updateSecondStep () { |
@@ -123,19 +124,19 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
123 | this.updateVideoAndCaptions(video), | 124 | this.updateVideoAndCaptions(video), |
124 | 125 | ||
125 | this.liveVideoService.updateLive(this.videoId, liveVideoUpdate) | 126 | this.liveVideoService.updateLive(this.videoId, liveVideoUpdate) |
126 | ]).subscribe( | 127 | ]).subscribe({ |
127 | () => { | 128 | next: () => { |
128 | this.notifier.success($localize`Live published.`) | 129 | this.notifier.success($localize`Live published.`) |
129 | 130 | ||
130 | this.router.navigateByUrl(Video.buildWatchUrl(video)) | 131 | this.router.navigateByUrl(Video.buildWatchUrl(video)) |
131 | }, | 132 | }, |
132 | 133 | ||
133 | err => { | 134 | error: err => { |
134 | this.error = err.message | 135 | this.error = err.message |
135 | scrollToTop() | 136 | scrollToTop() |
136 | console.error(err) | 137 | console.error(err) |
137 | } | 138 | } |
138 | ) | 139 | }) |
139 | } | 140 | } |
140 | 141 | ||
141 | getMaxLiveDuration () { | 142 | getMaxLiveDuration () { |
@@ -148,15 +149,15 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
148 | 149 | ||
149 | private fetchVideoLive () { | 150 | private fetchVideoLive () { |
150 | this.liveVideoService.getVideoLive(this.videoId) | 151 | this.liveVideoService.getVideoLive(this.videoId) |
151 | .subscribe( | 152 | .subscribe({ |
152 | liveVideo => { | 153 | next: liveVideo => { |
153 | this.liveVideo = liveVideo | 154 | this.liveVideo = liveVideo |
154 | }, | 155 | }, |
155 | 156 | ||
156 | err => { | 157 | error: err => { |
157 | this.firstStepError.emit() | 158 | this.firstStepError.emit() |
158 | this.notifier.error(err.message) | 159 | this.notifier.error(err.message) |
159 | } | 160 | } |
160 | ) | 161 | }) |
161 | } | 162 | } |
162 | } | 163 | } |