user3091110
user3091110

Reputation: 81

getting error: "Property 'user' does not exist on type 'ArrayBuffer'. in Angular

So I want to diplay user information in the Profilecomponent, but whenever I run the server I get the same message two times: Property 'user' does not exist on type 'ArrayBuffer'. I have tried to look it up but so far I havent got any clue what is causing this. Can anyone help? This is profile.component.ts:

  username;
email;

constructor(private auth: AuthService) { }

ngOnInit() {
this.auth.getProfile().subscribe(profile => {
  this.username = profile.user.username;
  this.email = profile.user.email;

  })
}

Upvotes: 1

Views: 681

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222720

Try changing the response as any, in this case,

this.auth.getProfile().subscribe((profile:any) => {
  this.username = profile.user.username;
  this.email = profile.user.email;
})

Upvotes: 2

Related Questions