1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| import {Component, Input, OnInit} from '@angular/core';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import {UserId} from '../../../model/home/UserId';
@Component({
selector: 'app-reset',
templateUrl: './reset.component.html',
styleUrls: ['./reset.component.css']
})
export class ResetComponent implements OnInit {
@Input() user: UserId;
public userId: UserId;
pswConfirm: any;
private server = 'http://localhost:8080/api/rest/';
constructor(private httpClient: HttpClient) {
this.userId = new UserId();
this.userId.psw = null;
this.userId.key = null;
this.userId.reset = null;
}
ngOnInit() {
this.submitreset();
}
async submitreset() {
const ParseHeaders = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
};
const jso = JSON.stringify(this.userId);
const apiUrl = this.server + `forgot`;
await this.httpClient.post<string>(apiUrl, jso, ParseHeaders).subscribe(res => {
this.userId.psw = res['psw'];
this.userId.key = res['key'];
this.userId.reset = res['reset'];
});
}
} |
Partager