import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { PreloadSelectedModules } from '../selective-preload-strategy';
import {AdminService} from './admin.services'
import { User } from './profile.interface';
import { AuthService } from '../auth.service';
import 'rxjs/add/operator/map';
@Component({
template: `
| User ID: | {{ user._id}} |
| Name: | {{ user.displayName}} |
| Email: | {{ user.email}} |
| Provider: | {{ user.provider}} |
| Provider ID: | {{ user.provider_id}} |
`
})
export class AdminDashboardComponent implements OnInit {
private user:User = new User();
constructor(private adminService: AdminService, private authService: AuthService) {
}
ngOnInit() {
this.getUserProfile();
}
getUserProfile() {
this.adminService.getProfile().subscribe(
profile => {
console.log(profile);
console.log(this.user = new User(profile._id, profile.displayName, profile.email, profile.picture,profile.provider,profile.provider_id));
//this.
},
err => {
console.log(err);
});
}
logout() {
this.authService.logout();
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/