WIP: proile component created.

This commit is contained in:
Jegor 2021-06-16 09:59:25 +02:00
parent 92de923fad
commit 8eba80f7d4
4 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,15 @@
<div class="container" *ngIf="currentUser; else loggedOut">
<p>
<strong>e-mail</strong>
{{ currentUser.email}}
</p>
<p>
<strong>username:</strong>
{{ currentUser.username}}
</p>
</div>
<ng-template #loggedOut>
Please login.
</ng-template>

View File

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProfileComponent } from './profile.component';
describe('ProfileComponent', () => {
let component: ProfileComponent;
let fixture: ComponentFixture<ProfileComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ProfileComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ProfileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,25 @@
import { Component, OnInit } from '@angular/core';
import {ApiService} from "../../services/api.service";
@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.css']
})
export class ProfileComponent implements OnInit {
currentUser: any;
obj:any
constructor(private api: ApiService ) { }
ngOnInit(): void {
this.api.getUserInfo().subscribe(
user=> {
this.currentUser = user
console.log(this.currentUser);
},
);
}
}