Http link .post error

http post error and i didn’t get where the code went wrong
this is in component.ts

  login(username: string, password: string) {
    // tslint:disable-next-line:max-line-length
    return this.http.post<{access_token: string}>('https://cloud-source.net/WMSService/api/v1/authenticate', {username, password}).pipe(tap(res => {
    localStorage.setItem('<acess token>', res.access_token);
}));
}
<form name="form" (ngSubmit)="f.form.valid && loginProcess()" #f="ngForm" novalidate>
  <div class="form-group" [ngClass]="{ 'has-error': f.submitted && !username.valid }">
      <label for="username">Username</label>
      <input type="text" class="form-control" name="username" [(ngModel)]="model.username" #username="ngModel" required />
      <div *ngIf="f.submitted && !username.valid" class="help-block">Username is required</div>
  </div>
  <div class="form-group" [ngClass]="{ 'has-error': f.submitted && !password.valid }">
      <label for="password">Password</label>
      <input type="password" class="form-control" name="password" [(ngModel)]="model.password" #password="ngModel" required />
      <div *ngIf="f.submitted && !password.valid" class="help-block">Password is required</div>
  </div>
  <div class="form-group">
      <button class="btn btn-primary" (click)="getEmployee()">Login</button>
  </div>
</form>

Can you post a github link to your angular project. Thank you

1 Like

sorry i didn’t check the message
here’s the github link

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.