AE
Size: a a a
AE
IF
K✔
save(data: FormData, token?: string): Observable<HttpEvent<HttpProgressEvent>> {
const apiUrl = this.configService.config.apiBaseUrl;
const url = `${apiUrl}`;
return this.httpClient.post<HttpProgressEvent>(url, data, {
reportProgress: true,
observe: "events"
});
}
this.filesService.save(formData)
.pipe(
uploadProgress(progress =>
this.state.files.progress = progress
),
toResponseBody()
).subscribe(res => {
this.state.files.progress = 0;
this.state.files.success = true;
});
function uploadProgress<T>(cb: (progress: number) => void) {
return tap((event: HttpEvent<T>) => {
if (event.type === HttpEventType.UploadProgress) {
cb(Math.round((100 * event.loaded) / event.total));
}
});
}
K✔
A
AM

K✔

K✔
AM
SV
SV
SV
AK

S

AK
AK
S
S
AK
GP
onSubmit() {
console.log(this.check())
if (this.form.invalid) {
return;
} else {
this.isLoading = !this.isLoading;
console.log(this.form);
this.signupService.signup(
this.form.value.email,
this.form.value.password,
this.form.value.empid,
this.form.value.forename,
this.form.value.surname)
.subscribe(data => {
this.responsedata = console.log(data)
this.isLoading = !this.isLoading;signup(email: string, password: string, empid: string, forename: string, surname: string ) {
let headers = new HttpHeaders();
headers = headers.append('Content-Type', 'application/json');
headers = headers.append('X-XSRF-TOKEN', this.getCookie('XSRF-TOKEN'));
const httpOptions = {
headers
};
const data = JSON.stringify({email, forename, surname, empid, password});
return this.http.post<any>(this.domain + '/auth/signup/', data, httpOptions)
.pipe(catchError(this.handleError)
);
}