diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index 8c7d093..22cf518 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -23,6 +23,10 @@ export const appRoutes: Routes = [ path: RouteConfig.loginPath, component: LoginComponent }, + { + path: RouteConfig.editProfilePath, + loadChildren: './profile/edit-profile.module#EditProfileModule' + }, { path: RouteConfig.signUpPath, component: SignupComponent diff --git a/static/src/app/profile/edit-profile.component.css b/static/src/app/profile/edit-profile.component.css new file mode 100644 index 0000000..e69de29 diff --git a/static/src/app/profile/edit-profile.component.html b/static/src/app/profile/edit-profile.component.html new file mode 100644 index 0000000..b2dae9b --- /dev/null +++ b/static/src/app/profile/edit-profile.component.html @@ -0,0 +1,71 @@ +
+ +

Profil editieren

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/static/src/app/profile/edit-profile.component.ts b/static/src/app/profile/edit-profile.component.ts new file mode 100644 index 0000000..71aca3b --- /dev/null +++ b/static/src/app/profile/edit-profile.component.ts @@ -0,0 +1,40 @@ +import {Component} from "@angular/core"; +import {AppUser, Squad} from "../models/model-interfaces"; +import {Observable} from "rxjs/Observable"; +import {AppUserService} from "../services/app-user-service/app-user.service"; +import {SquadService} from "../services/squad-service/squad.service"; +import {LoginService} from "../services/login-service/login-service"; +import {Router} from "@angular/router"; + + +@Component({ + selector: 'edit-profile', + templateUrl: './edit-profile.component.html', + styleUrls: ['./edit-profile.component.css'] +}) +export class EditProfileComponent { + + user = {}; + + showSuccessLabel = false; + + constructor(private appUserService: AppUserService, + private loginService: LoginService, + private router: Router) { + } + + ngOnInit() { + this.user = this.appUserService.getUsers(); + } + + deleteUser(user) { + if (confirm('Bistdu dir sicher dass du deinen Nutzer Account "' + user.username + '" loeschen willst?')) { + this.appUserService.deleteUser(user) + .subscribe((res) => { + this.loginService.logout(); + // TODO: redirect to / + }) + } + } + +} diff --git a/static/src/app/profile/edit-profile.module.ts b/static/src/app/profile/edit-profile.module.ts new file mode 100644 index 0000000..8e51ca9 --- /dev/null +++ b/static/src/app/profile/edit-profile.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from "@angular/core"; +import {SharedModule} from "../shared.module"; +import {AppUserService} from "../services/app-user-service/app-user.service"; +import {CommonModule} from "@angular/common"; +import {RouterModule} from "@angular/router"; +import {EditProfileComponent} from "./edit-profile.component"; +import {AppUserStore} from "../services/stores/app-user.store"; + +@NgModule({ + declarations: [EditProfileComponent], + imports: [CommonModule, SharedModule, RouterModule.forChild([{path: '', component: EditProfileComponent}])], + providers: [AppUserStore, AppUserService] +}) +export class EditProfileModule { +}