]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/video-list/video-list.component.ts
Client: check token valitidy at startup
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-list.component.ts
index 6b086e93880b34cee8c2fba58f4878406b215d7a..844e14567883b88b65df53770265c207ddf8a01b 100644 (file)
@@ -2,12 +2,15 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { BehaviorSubject } from 'rxjs/BehaviorSubject';
 
+import { NotificationsService } from 'angular2-notifications';
+
 import {
   SortField,
   Video,
   VideoService
 } from '../shared';
-import { AuthService, AuthUser, RestPagination, Search, SearchField } from '../../shared';
+import { AuthService, AuthUser } from '../../core';
+import { RestPagination, Search, SearchField } from '../../shared';
 import { SearchService } from '../../shared';
 
 @Component({
@@ -32,6 +35,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
   private subSearch: any;
 
   constructor(
+    private notificationsService: NotificationsService,
     private authService: AuthService,
     private changeDetector: ChangeDetectorRef,
     private router: Router,
@@ -90,7 +94,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
 
         this.loading.next(false);
       },
-      error => alert(error.text)
+      error => this.notificationsService.error('Error', error.text)
     );
   }
 
@@ -106,6 +110,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
   }
 
   onRemoved(video: Video) {
+    this.notificationsService.success('Success', `Video ${video.name} deleted.`);
     this.getVideos();
   }
 
@@ -144,7 +149,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
       };
     }
 
-    this.sort = <SortField>routeParams['sort'] || '-createdDate';
+    this.sort = <SortField>routeParams['sort'] || '-createdAt';
 
     if (routeParams['page'] !== undefined) {
       this.pagination.currentPage = parseInt(routeParams['page']);