diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-18 15:31:54 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-18 15:40:59 +0100 |
commit | ba430d7516bc5b1324b60571ba7594460969b7fb (patch) | |
tree | df5c6952c82f49a94c0a884bbc97d4a0cbd9f867 /client/src/app/+my-account/my-account-video-playlists | |
parent | 5dfb7c1dec8222b0bbccac5b56ad46da1438747e (diff) | |
download | PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.gz PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.zst PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.zip |
Lazy load static objects
Diffstat (limited to 'client/src/app/+my-account/my-account-video-playlists')
2 files changed, 15 insertions, 12 deletions
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts index 8aed8b513..e47e5f980 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts | |||
@@ -47,15 +47,14 @@ export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylis | |||
47 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 47 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
48 | .catch(err => console.error('Cannot populate user video channels.', err)) | 48 | .catch(err => console.error('Cannot populate user video channels.', err)) |
49 | 49 | ||
50 | this.serverService.videoPlaylistPrivaciesLoaded.subscribe( | 50 | this.serverService.getVideoPlaylistPrivacies() |
51 | () => { | 51 | .subscribe(videoPlaylistPrivacies => { |
52 | this.videoPlaylistPrivacies = this.serverService.getVideoPlaylistPrivacies() | 52 | this.videoPlaylistPrivacies = videoPlaylistPrivacies |
53 | 53 | ||
54 | this.form.patchValue({ | 54 | this.form.patchValue({ |
55 | privacy: VideoPlaylistPrivacy.PRIVATE | 55 | privacy: VideoPlaylistPrivacy.PRIVATE |
56 | }) | ||
56 | }) | 57 | }) |
57 | } | ||
58 | ) | ||
59 | } | 58 | } |
60 | 59 | ||
61 | formValidated () { | 60 | formValidated () { |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts index 917ad7258..2f85cdd96 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { AuthService, Notifier, ServerService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService } from '@app/core' |
4 | import { Subscription } from 'rxjs' | 4 | import { forkJoin, Subscription } from 'rxjs' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
7 | import { MyAccountVideoPlaylistEdit } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-edit' | 7 | import { MyAccountVideoPlaylistEdit } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-edit' |
@@ -56,13 +56,17 @@ export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylis | |||
56 | this.paramsSub = this.route.params | 56 | this.paramsSub = this.route.params |
57 | .pipe( | 57 | .pipe( |
58 | map(routeParams => routeParams['videoPlaylistId']), | 58 | map(routeParams => routeParams['videoPlaylistId']), |
59 | switchMap(videoPlaylistId => this.videoPlaylistService.getVideoPlaylist(videoPlaylistId)), | 59 | switchMap(videoPlaylistId => { |
60 | delayWhen(() => this.serverService.videoPlaylistPrivaciesLoaded) | 60 | return forkJoin([ |
61 | this.videoPlaylistService.getVideoPlaylist(videoPlaylistId), | ||
62 | this.serverService.getVideoPlaylistPrivacies() | ||
63 | ]) | ||
64 | }) | ||
61 | ) | 65 | ) |
62 | .subscribe( | 66 | .subscribe( |
63 | videoPlaylistToUpdate => { | 67 | ([ videoPlaylistToUpdate, videoPlaylistPrivacies]) => { |
64 | this.videoPlaylistPrivacies = this.serverService.getVideoPlaylistPrivacies() | ||
65 | this.videoPlaylistToUpdate = videoPlaylistToUpdate | 68 | this.videoPlaylistToUpdate = videoPlaylistToUpdate |
69 | this.videoPlaylistPrivacies = videoPlaylistPrivacies | ||
66 | 70 | ||
67 | this.hydrateFormFromPlaylist() | 71 | this.hydrateFormFromPlaylist() |
68 | }, | 72 | }, |