Skip to content

Commit

Permalink
fix(user): profile edit component properly creates user
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalshaikh42 committed Mar 3, 2020
1 parent 280efae commit 0bed682
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -6,7 +6,7 @@ import {
SimpleSnackBar,
} from '@angular/material/snack-bar';
import { AuthService } from 'src/app/Shared/Services/auth0.service';
import { User } from 'src/app/Shared/Models/user';
import { User, UserSerializer } from 'src/app/Shared/Models/user';
import { UserService } from 'src/app/Shared/Services/user.service';
import { NavItemDisplayLevel } from 'src/app/Shared/Enums/nav-item-display-level';
import { NavItem } from 'src/app/Shared/Models/nav-item';
Expand All @@ -23,6 +23,7 @@ import { Router } from '@angular/router';
})
export class ProfileEditComponent implements OnInit {
formGroup: FormGroup;
userSerializer: UserSerializer;

constructor(
@Inject(BreadCrumbsService) private breadCrumbsService: BreadCrumbsService,
Expand All @@ -32,6 +33,7 @@ export class ProfileEditComponent implements OnInit {
private userService: UserService,
private router: Router
) {
this.userSerializer = new UserSerializer();
this.formGroup = this.formBuilder.group({
userName: [''],
firstName: [''],
Expand Down Expand Up @@ -79,7 +81,8 @@ export class ProfileEditComponent implements OnInit {
const saving = this.saving();
const username = this.auth.getUsername$();
const userId = this.auth.getUser$().pipe();
const data: User = this.formGroup.value as User;
const data: User = this.userSerializer.fromJson(this.formGroup.value);
console.log(data);

this.auth.getUsername$().subscribe(name => {
this.auth
Expand Down

0 comments on commit 0bed682

Please sign in to comment.