Skip to content

Commit

Permalink
decoded tokebn fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Oktawian-L committed Nov 4, 2019
1 parent eb616e1 commit d21cae3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Subiton/src/app/users/user-edit/user-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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 {

Expand Down Expand Up @@ -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);
});

}
}
Binary file modified SubitonAPI/SubitonAPI/Subiton.db
Binary file not shown.

0 comments on commit d21cae3

Please sign in to comment.