diff options
Diffstat (limited to 'src/DevHive.Angular')
5 files changed, 35 insertions, 2 deletions
diff --git a/src/DevHive.Angular/src/app/app-routing.module.ts b/src/DevHive.Angular/src/app/app-routing.module.ts index b733655..5799d80 100644 --- a/src/DevHive.Angular/src/app/app-routing.module.ts +++ b/src/DevHive.Angular/src/app/app-routing.module.ts @@ -3,11 +3,13 @@ import { Routes, RouterModule } from '@angular/router'; import { FeedComponent } from './components/feed/feed.component'; import { LoginComponent } from './components/login/login.component'; import { RegisterComponent } from './components/register/register.component'; +import { ProfileComponent } from './components/profile/profile.component'; const routes: Routes = [ { path: '', component: FeedComponent }, { path: 'login', component: LoginComponent }, - { path: 'register', component: RegisterComponent } + { path: 'register', component: RegisterComponent }, + { path: 'profile/:username', component: ProfileComponent } ]; @NgModule({ diff --git a/src/DevHive.Angular/src/app/app.module.ts b/src/DevHive.Angular/src/app/app.module.ts index 6270561..d1030c3 100644 --- a/src/DevHive.Angular/src/app/app.module.ts +++ b/src/DevHive.Angular/src/app/app.module.ts @@ -12,6 +12,7 @@ import { LoginComponent } from './components/login/login.component'; import { RegisterComponent } from './components/register/register.component'; import { FeedComponent } from './components/feed/feed.component'; import { PostComponent } from './components/post/post.component'; +import { ProfileComponent } from './components/profile/profile.component'; @NgModule({ declarations: [ @@ -19,7 +20,8 @@ import { PostComponent } from './components/post/post.component'; LoginComponent, RegisterComponent, FeedComponent, - PostComponent + PostComponent, + ProfileComponent ], imports: [ BrowserModule, diff --git a/src/DevHive.Angular/src/app/components/profile/profile.component.css b/src/DevHive.Angular/src/app/components/profile/profile.component.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/DevHive.Angular/src/app/components/profile/profile.component.css diff --git a/src/DevHive.Angular/src/app/components/profile/profile.component.html b/src/DevHive.Angular/src/app/components/profile/profile.component.html new file mode 100644 index 0000000..9df0576 --- /dev/null +++ b/src/DevHive.Angular/src/app/components/profile/profile.component.html @@ -0,0 +1 @@ +<p>profile works!</p> diff --git a/src/DevHive.Angular/src/app/components/profile/profile.component.ts b/src/DevHive.Angular/src/app/components/profile/profile.component.ts new file mode 100644 index 0000000..6b40e31 --- /dev/null +++ b/src/DevHive.Angular/src/app/components/profile/profile.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { Guid } from 'guid-typescript'; +import { UserService } from 'src/app/services/user.service'; +import { User } from 'src/models/identity/user'; +import { AppConstants } from 'src/app/app-constants.module'; + +@Component({ + selector: 'app-profile', + templateUrl: './profile.component.html', + styleUrls: ['./profile.component.css'] +}) +export class ProfileComponent implements OnInit { + public dataArrived = false; + public user: User; + + constructor(private _router: Router, private _userService: UserService) + { } + + ngOnInit(): void { + const username = this._router.url.substring(9); + console.log(username); + // Workaround for waiting the fetch response + // TODO: properly wait for it, before loading the page contents + // setTimeout(() => { this.user = this._userService.fetchUserFromSessionStorage(); }, AppConstants.FETCH_TIMEOUT); + // setTimeout(() => { this.dataArrived = true; }, AppConstants.FETCH_TIMEOUT + 100); + } +} |
