From d21cae35e6cae37adcd6735bbdb723161a4fb61f Mon Sep 17 00:00:00 2001 From: Oktawian-L Date: Mon, 4 Nov 2019 19:31:46 +0100 Subject: [PATCH] decoded tokebn fix --- .../users/user-edit/user-edit.component.ts | 17 ++++++++++++----- SubitonAPI/SubitonAPI/Subiton.db | Bin 114688 -> 114688 bytes 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Subiton/src/app/users/user-edit/user-edit.component.ts b/Subiton/src/app/users/user-edit/user-edit.component.ts index 25fbd80..4ff648c 100644 --- a/Subiton/src/app/users/user-edit/user-edit.component.ts +++ b/Subiton/src/app/users/user-edit/user-edit.component.ts @@ -5,6 +5,7 @@ import { NgxGalleryImage, NgxGalleryOptions, NgxGalleryAnimation } from 'ngx-gal import { AlertifyService } from 'src/app/_services/alertify.service'; import { NgForm } from '@angular/forms'; import { UserService } from 'src/app/_services/user.service'; +import { AuthorizationService } from 'src/app/_services/authorization.service'; @Component({ selector: 'app-user-edit', @@ -29,7 +30,8 @@ export class UserEditComponent implements OnInit { constructor(private route: ActivatedRoute, private alertify: AlertifyService, - private userService: UserService) { } + private userService: UserService, + private authServie: AuthorizationService) { } ngOnInit(): void { @@ -93,9 +95,14 @@ export class UserEditComponent implements OnInit { updateUser(formUser: User) { console.log(this.editForm.updateModel); console.log(this.editForm.value); - console.log(this.editForm.valueChanges); - this.userService.updateUser(this.user.id, this.editForm.value); - this.alertify.success('Succesfully saved changes.'); - this.editForm.reset(this.editForm.value); + console.log(this.authServie.decodedToken.nameid[0]); + this.userService.updateUser(this.authServie.decodedToken.nameid[0], this.editForm.value) + .subscribe(next => { + this.alertify.success('Succesfully saved changes.'); + this.editForm.reset(this.editForm.value); + }, error => { + this.alertify.error(error); + }); + } } diff --git a/SubitonAPI/SubitonAPI/Subiton.db b/SubitonAPI/SubitonAPI/Subiton.db index 149213ac62cab9c7fae32fb8c98699f5320f1b58..a15a5a31c0ccd3e7405cb820fce1f0e3c15af81e 100644 GIT binary patch delta 95 zcmZo@U~d4TEsSgn_@*Qqw*(L=wDF(?#o+cg!24iCeK?VkX xK?Y+6AQ0qWn7(5n;~Uo06aypU=@S<*3Uip5H%Y2WGDuFo*etyL@*+lESpb^?7{&kq delta 103 zcmZo@U~d4TEsSgn_~tOP8?p&8Ut{^mw2N`h#>NgtnI>s9Ne0PAo+cg!24iCeAmA5d t0MiT{)3+>Sd?RCEWNctyV5kd53I+yNVALe33e-3GVzcn}%ZnIwWdSqu88iR@