diff --git a/Client/src/app/app.module.ts b/Client/src/app/app.module.ts
index e52a074..2612662 100644
--- a/Client/src/app/app.module.ts
+++ b/Client/src/app/app.module.ts
@@ -24,6 +24,9 @@ import { MemberCardComponent } from './components/members/member-card/member-car
import { MemberDetailComponent } from './components/members/member-detail/member-detail.component';
import { MemberDetailResolver } from './resolvers/member-detail.resolver';
import { MemberListResolver } from './resolvers/member-list.resolver';
+import { MemberEditComponent } from './components/members/member-edit/member-edit.component';
+import { MemberEditResolver } from './resolvers/member-edit.resolver';
+
export function tokenGetter() {
return localStorage.getItem("token");
@@ -39,7 +42,8 @@ export function tokenGetter() {
ListsComponent,
MessagesComponent,
MemberCardComponent,
- MemberDetailComponent
+ MemberDetailComponent,
+ MemberEditComponent
],
imports: [
BrowserModule,
@@ -64,7 +68,8 @@ export function tokenGetter() {
AuthGuard,
UserService,
MemberDetailResolver,
- MemberListResolver
+ MemberListResolver,
+ MemberEditResolver
],
bootstrap: [AppComponent]
})
diff --git a/Client/src/app/components/members/member-edit/member-edit.component.css b/Client/src/app/components/members/member-edit/member-edit.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/Client/src/app/components/members/member-edit/member-edit.component.html b/Client/src/app/components/members/member-edit/member-edit.component.html
new file mode 100644
index 0000000..29ac1ec
--- /dev/null
+++ b/Client/src/app/components/members/member-edit/member-edit.component.html
@@ -0,0 +1,3 @@
+
+{{user.knownAs}}
+
diff --git a/Client/src/app/components/members/member-edit/member-edit.component.spec.ts b/Client/src/app/components/members/member-edit/member-edit.component.spec.ts
new file mode 100644
index 0000000..dd5b5bd
--- /dev/null
+++ b/Client/src/app/components/members/member-edit/member-edit.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { MemberEditComponent } from './member-edit.component';
+
+describe('MemberEditComponent', () => {
+ let component: MemberEditComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ MemberEditComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(MemberEditComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/Client/src/app/components/members/member-edit/member-edit.component.ts b/Client/src/app/components/members/member-edit/member-edit.component.ts
new file mode 100644
index 0000000..3556c7e
--- /dev/null
+++ b/Client/src/app/components/members/member-edit/member-edit.component.ts
@@ -0,0 +1,21 @@
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import { User } from 'src/app/models/user';
+
+@Component({
+ selector: 'app-member-edit',
+ templateUrl: './member-edit.component.html',
+ styleUrls: ['./member-edit.component.css']
+})
+export class MemberEditComponent implements OnInit {
+ user: User;
+
+ constructor(private route: ActivatedRoute) { }
+
+ ngOnInit() {
+ this.route.data.subscribe(data => {
+ this.user = data['user'];
+ });
+ }
+
+}
diff --git a/Client/src/app/components/nav-menu/nav-menu.component.html b/Client/src/app/components/nav-menu/nav-menu.component.html
index 6a29e22..053ab87 100644
--- a/Client/src/app/components/nav-menu/nav-menu.component.html
+++ b/Client/src/app/components/nav-menu/nav-menu.component.html
@@ -20,7 +20,7 @@
diff --git a/Client/src/app/resolvers/member-edit.resolver.ts b/Client/src/app/resolvers/member-edit.resolver.ts
new file mode 100644
index 0000000..d894ab5
--- /dev/null
+++ b/Client/src/app/resolvers/member-edit.resolver.ts
@@ -0,0 +1,27 @@
+import { Injectable } from "@angular/core";
+import { User } from "../models/user";
+import { UserService } from "../services/user.service";
+import { Resolve, Router, ActivatedRouteSnapshot } from "@angular/router";
+import { AlertifyService } from "../services/alertify.service";
+import { Observable, of } from "rxjs";
+import { catchError } from "rxjs/operators";
+import { AuthService } from "../services/auth.service";
+
+@Injectable()
+export class MemberEditResolver implements Resolve {
+
+ constructor(
+ private userService: UserService,
+ private authService: AuthService,
+ private router: Router,
+ private alertify: AlertifyService) { }
+
+ resolve(route: ActivatedRouteSnapshot): Observable {
+ return this.userService.getUser(this.authService.decodedToken.nameid)
+ .pipe(catchError(error => {
+ this.alertify.error('Problem retrieving your data');
+ this.router.navigate(['/members']);
+ return of(null);
+ }));
+ }
+}
diff --git a/Client/src/app/routes.ts b/Client/src/app/routes.ts
index 943abed..b510a8e 100644
--- a/Client/src/app/routes.ts
+++ b/Client/src/app/routes.ts
@@ -7,6 +7,8 @@ import { AuthGuard } from './guards/auth.guard';
import { MemberDetailComponent } from './components/members/member-detail/member-detail.component';
import { MemberDetailResolver } from './resolvers/member-detail.resolver';
import { MemberListResolver } from './resolvers/member-list.resolver';
+import { MemberEditComponent } from './components/members/member-edit/member-edit.component';
+import { MemberEditResolver } from './resolvers/member-edit.resolver';
export const appRoutes: Routes = [
{ path: '', component: HomeComponent },
@@ -16,7 +18,10 @@ export const appRoutes: Routes = [
canActivate: [AuthGuard],
children: [
{ path: 'members', component: MemberListComponent, resolve: { users: MemberListResolver } },
- { path: 'members/:id', component: MemberDetailComponent, resolve: { user: MemberDetailResolver } },
+ { path: 'members/edit', component: MemberEditComponent, resolve: { user: MemberEditResolver },
+ { path: 'members/:id', component: MemberDetailComponent,
+ resolve: { user: MemberDetailResolver }
+ },
{ path: 'messages', component: MessagesComponent },
{ path: 'lists', component: ListsComponent }
]
diff --git a/Friendster.csproj b/Friendster.csproj
index 679c7b6..d5600c2 100644
--- a/Friendster.csproj
+++ b/Friendster.csproj
@@ -10,6 +10,7 @@
+