]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/app.component.ts
Client: Get videos -> See videos
[github/Chocobozzz/PeerTube.git] / client / src / app / app.component.ts
index f53896bcf151dd09125b1dc4b8c140fe4389d97e..ce4fc04fffc85c4e9adb58b5b28902fab7abba64 100644 (file)
@@ -1,74 +1,21 @@
-import { Component } from '@angular/core';
-import { ActivatedRoute, Router, ROUTER_DIRECTIVES } from '@angular/router';
-
-import { FriendService } from './friends';
-import {
-  AuthService,
-  AuthStatus,
-  SearchComponent,
-  SearchService
-} from './shared';
-import { VideoService } from './videos';
+import { Component, ViewContainerRef } from '@angular/core';
+import { Router } from '@angular/router';
 
+import { MetaService } from 'ng2-meta';
 @Component({
-    selector: 'my-app',
-    template: require('./app.component.html'),
-    styles: [ require('./app.component.scss') ],
-    directives: [ ROUTER_DIRECTIVES, SearchComponent ],
-    providers: [ FriendService, VideoService, SearchService ]
+  selector: 'my-app',
+  templateUrl: './app.component.html',
+  styleUrls: [ './app.component.scss' ]
 })
 
 export class AppComponent {
-  choices = [];
-  isLoggedIn: boolean;
-
   constructor(
-    private authService: AuthService,
-    private friendService: FriendService,
-    private route: ActivatedRoute,
-    private router: Router
-  ) {
-    this.isLoggedIn = this.authService.isLoggedIn();
-
-    this.authService.loginChangedSource.subscribe(
-      status => {
-        if (status === AuthStatus.LoggedIn) {
-          this.isLoggedIn = true;
-          console.log('Logged in.');
-        } else if (status === AuthStatus.LoggedOut) {
-          this.isLoggedIn = false;
-          console.log('Logged out.');
-        } else {
-          console.error('Unknown auth status: ' + status);
-        }
-      }
-    );
-  }
-
-  logout() {
-    this.authService.logout();
-    this.authService.setStatus(AuthStatus.LoggedOut);
-  }
-
-  makeFriends() {
-    this.friendService.makeFriends().subscribe(
-      status => {
-        if (status === 409) {
-          alert('Already made friends!');
-        } else {
-          alert('Made friends!');
-        }
-      },
-      error => alert(error)
-    );
-  }
+    private router: Router,
+    private metaService: MetaService,
+    viewContainerRef: ViewContainerRef
+  ) {}
 
-  quitFriends() {
-    this.friendService.quitFriends().subscribe(
-      status => {
-        alert('Quit friends!');
-      },
-      error => alert(error)
-    );
+  isInAdmin() {
+    return this.router.url.indexOf('/admin/') !== -1;
   }
 }