aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Angular
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-01-16 12:32:19 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-01-16 12:32:19 +0200
commit548a12b25a4dfe15f322d25763a66684df218231 (patch)
treec4695918df167ce9023ace44829fb06445e320e4 /src/DevHive.Angular
parentf883be8a624eebe789280d900632d34fe0e088f5 (diff)
downloadDevHive-548a12b25a4dfe15f322d25763a66684df218231.tar
DevHive-548a12b25a4dfe15f322d25763a66684df218231.tar.gz
DevHive-548a12b25a4dfe15f322d25763a66684df218231.zip
Added the starting point of the user profile component
Diffstat (limited to 'src/DevHive.Angular')
-rw-r--r--src/DevHive.Angular/src/app/app-routing.module.ts4
-rw-r--r--src/DevHive.Angular/src/app/app.module.ts4
-rw-r--r--src/DevHive.Angular/src/app/components/profile/profile.component.css0
-rw-r--r--src/DevHive.Angular/src/app/components/profile/profile.component.html1
-rw-r--r--src/DevHive.Angular/src/app/components/profile/profile.component.ts28
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);
+ }
+}