Prevent creating multiple lives
This commit is contained in:
parent
9a3f72508c
commit
2f6e173002
|
@ -61,7 +61,7 @@
|
||||||
<div class="submit-container">
|
<div class="submit-container">
|
||||||
<my-button className="orange-button" i18n-label label="Update" icon="circle-tick"
|
<my-button className="orange-button" i18n-label label="Update" icon="circle-tick"
|
||||||
(click)="updateSecondStep()"
|
(click)="updateSecondStep()"
|
||||||
[disabled]="!form.valid"
|
[disabled]="!form.valid || isUpdatingVideo === true"
|
||||||
></my-button>
|
></my-button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -27,6 +27,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
|
||||||
firstStepPermanentLive: boolean
|
firstStepPermanentLive: boolean
|
||||||
|
|
||||||
isInUpdateForm = false
|
isInUpdateForm = false
|
||||||
|
isUpdatingVideo = false
|
||||||
|
isOrHasGoingLive = false
|
||||||
|
|
||||||
liveVideo: LiveVideo
|
liveVideo: LiveVideo
|
||||||
|
|
||||||
|
@ -64,6 +66,9 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
|
||||||
}
|
}
|
||||||
|
|
||||||
goLive () {
|
goLive () {
|
||||||
|
if (this.isOrHasGoingLive) return
|
||||||
|
this.isOrHasGoingLive = true
|
||||||
|
|
||||||
const name = 'Live'
|
const name = 'Live'
|
||||||
|
|
||||||
const video: LiveVideoCreate = {
|
const video: LiveVideoCreate = {
|
||||||
|
@ -115,6 +120,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
|
||||||
async updateSecondStep () {
|
async updateSecondStep () {
|
||||||
if (!await this.isFormValid()) return
|
if (!await this.isFormValid()) return
|
||||||
|
|
||||||
|
this.isUpdatingVideo = true
|
||||||
|
|
||||||
const video = new VideoEdit()
|
const video = new VideoEdit()
|
||||||
video.patch(this.form.value)
|
video.patch(this.form.value)
|
||||||
video.id = this.videoId
|
video.id = this.videoId
|
||||||
|
@ -134,6 +141,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
|
||||||
this.liveVideoService.updateLive(this.videoId, liveVideoUpdate)
|
this.liveVideoService.updateLive(this.videoId, liveVideoUpdate)
|
||||||
]).subscribe({
|
]).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
|
this.isUpdatingVideo = false
|
||||||
|
|
||||||
this.notifier.success($localize`Live published.`)
|
this.notifier.success($localize`Live published.`)
|
||||||
|
|
||||||
this.router.navigateByUrl(Video.buildWatchUrl(video))
|
this.router.navigateByUrl(Video.buildWatchUrl(video))
|
||||||
|
|
Loading…
Reference in New Issue