0

In my Angular-11 Application, I have these three (3) functions with these errors:

changePassword(data: any) {
  const submitData = {
    token: data.token,
    ['old_password']: data.oldPassword,
    ['new_password']: data.newPassword,
    ['new_password_confirmation']: data.newPasswordConfirmation,
  };
  return this.http.post('api/password/reset', submitData);
}

expected call-signature: 'changePassword' to have a typedeftslint(typedef)

contactAdmin(_data: { email: string }) {
  return of({
    message: 'Yes'
  });
}

expected call-signature: 'contactAdmin' to have a typedeftslint(typedef)

resetPassword(email: { email: string }) {
  return this.http.post('api/password/email', email);
}

expected call-signature: 'resetPassword' to have a typedeftslint(typedef)

How do I resolve the errors?

Thanks

user11352561
  • 2,277
  • 12
  • 51
  • 102

1 Answers1

0

You need to signal what the methods will return.

changePassword(data: any): Observable<any> { // change any to what this post request will return
  const submitData = {
    token: data.token,
    ['old_password']: data.oldPassword,
    ['new_password']: data.newPassword,
    ['new_password_confirmation']: data.newPasswordConfirmation,
  };
  return this.http.post('api/password/reset', submitData);
}

contactAdmin(_data: { email: string }): Observable<{ message: string>} {
  return of({
    message: 'Yes'
  });
}

resetPassword(email: { email: string }): Observable<any> { // again with the any
  return this.http.post('api/password/email', email);
}
AliF50
  • 16,947
  • 1
  • 21
  • 37