profile + i18n
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<br>
|
||||
<mat-progress-bar *ngIf="!success && !error" mode="indeterminate"></mat-progress-bar>
|
||||
|
||||
<div *ngIf="success">
|
||||
<h3>{{username}}</h3>
|
||||
<app-profilefields [profileFields]="profileFields"></app-profilefields>
|
||||
</div>
|
||||
|
||||
<mat-card *ngIf="error">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{error.status}}</mat-card-title>
|
||||
<mat-card-subtitle>{{'user.unavailable' | i18n}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<p>
|
||||
{{'user.unavailable.text' | i18n}}
|
||||
</p>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@@ -0,0 +1,3 @@
|
||||
h3 {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UserComponent } from './user.component';
|
||||
|
||||
describe('UserComponent', () => {
|
||||
let component: UserComponent;
|
||||
let fixture: ComponentFixture<UserComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ UserComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UserComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
|
||||
import {ActivatedRoute, Router, ParamMap} from '@angular/router';
|
||||
|
||||
import {ProfileService} from '../../services/profile.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user',
|
||||
templateUrl: './user.component.html',
|
||||
styleUrls: ['./user.component.scss']
|
||||
})
|
||||
export class UserComponent implements OnInit {
|
||||
|
||||
username;
|
||||
profileFields = [];
|
||||
error = false;
|
||||
success = false;
|
||||
|
||||
constructor(
|
||||
private profileService: ProfileService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.username = this.route.snapshot.paramMap.get('username');
|
||||
this.profileService.getAllForUser(this.username).subscribe((data: any) => {
|
||||
this.profileFields = data;
|
||||
this.success = true;
|
||||
}, error => {
|
||||
this.error = error;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user