]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/app.component.ts
Client: save page params as well
[github/Chocobozzz/PeerTube.git] / client / src / app / app.component.ts
index 0cee6edbf7cfb904924b83adcbc0522cb29f98dd..354d00a7a78479598662767e70b39098518d9959 100644 (file)
@@ -1,52 +1,22 @@
 import { Component } from '@angular/core';
 import { HTTP_PROVIDERS } from '@angular/http';
-import { Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Routes } from '@angular/router';
+import { ActivatedRoute, Router, ROUTER_DIRECTIVES } from '@angular/router';
 
 import { FriendService } from './friends';
-import { LoginComponent } from './login';
 import {
   AuthService,
   AuthStatus,
-  Search,
-  SearchComponent
+  SearchComponent,
+  SearchService
 } from './shared';
-import {
-  VideoAddComponent,
-  VideoListComponent,
-  VideoWatchComponent,
-  VideoService
-} from './videos';
-import { SearchService } from './shared'; // Temporary
-
-@Routes([
-  {
-    path: '/users/login',
-    component: LoginComponent
-  },
-  {
-    path: '/videos/list',
-    component: VideoListComponent
-  },
-  {
-    path: '/videos/watch/:id',
-    component: VideoWatchComponent
-  },
-  {
-    path: '/videos/add',
-    component: VideoAddComponent
-  },
-  {
-    path: '/',
-    component: VideoListComponent
-  }
-])
+import { VideoService } from './videos';
 
 @Component({
     selector: 'my-app',
     template: require('./app.component.html'),
     styles: [ require('./app.component.scss') ],
     directives: [ ROUTER_DIRECTIVES, SearchComponent ],
-    providers: [ AuthService, FriendService, HTTP_PROVIDERS, ROUTER_PROVIDERS, VideoService, SearchService ]
+    providers: [ AuthService, FriendService, HTTP_PROVIDERS, VideoService, SearchService ]
 })
 
 export class AppComponent {
@@ -56,6 +26,7 @@ export class AppComponent {
   constructor(
     private authService: AuthService,
     private friendService: FriendService,
+    private route: ActivatedRoute,
     private router: Router
   ) {
     this.isLoggedIn = this.authService.isLoggedIn();
@@ -69,18 +40,6 @@ export class AppComponent {
     );
   }
 
-  onSearch(search: Search) {
-    if (search.value !== '') {
-      const params = {
-        field: search.field,
-        search: search.value
-      };
-      this.router.navigate(['/videos/list', params]);
-    } else {
-      this.router.navigate(['/videos/list']);
-    }
-  }
-
   // FIXME
   logout() {
     // this._authService.logout();