]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video/video.service.ts
Use sequelize scopes
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video.service.ts
index 3f35b67c42ab1a30190f1fa37f8dbb0c43287e27..91dd3977a733c049d31fc2d21ba7fb19eba6bc7a 100644 (file)
@@ -9,9 +9,9 @@ import { UserVideoRateUpdate } from '../../../../../shared/models/videos/user-vi
 import { UserVideoRate } from '../../../../../shared/models/videos/user-video-rate.model'
 import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type'
 import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model'
+import { environment } from '../../../environments/environment'
 import { RestExtractor } from '../rest/rest-extractor.service'
 import { RestService } from '../rest/rest.service'
-import { Search } from '../header/search.model'
 import { UserService } from '../users/user.service'
 import { SortField } from './sort-field.type'
 import { VideoDetails } from './video-details.model'
@@ -21,7 +21,7 @@ import { Video } from './video.model'
 
 @Injectable()
 export class VideoService {
-  private static BASE_VIDEO_URL = API_URL + '/api/v1/videos/'
+  private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/'
 
   constructor (
     private authHttp: HttpClient,
@@ -42,14 +42,17 @@ export class VideoService {
   }
 
   updateVideo (video: VideoEdit) {
-    const language = video.language ? video.language : null
+    const language = video.language || undefined
+    const licence = video.licence || undefined
+    const category = video.category || undefined
+    const description = video.description || undefined
 
     const body: VideoUpdate = {
       name: video.name,
-      category: video.category,
-      licence: video.licence,
+      category,
+      licence,
       language,
-      description: video.description,
+      description,
       privacy: video.privacy,
       tags: video.tags,
       nsfw: video.nsfw
@@ -115,7 +118,7 @@ export class VideoService {
 
   loadCompleteDescription (descriptionPath: string) {
     return this.authHttp
-      .get(API_URL + descriptionPath)
+      .get(environment.apiUrl + descriptionPath)
       .map(res => res['description'])
       .catch((res) => this.restExtractor.handleError(res))
   }