|
|
@ -1,6 +1,6 @@
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { User } from '../models/user.model';
|
|
|
|
import { User } from '../models/user.model';
|
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
import { HttpClient, HttpResponse } from '@angular/common/http';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { NgForm } from '@angular/forms';
|
|
|
|
import { NgForm } from '@angular/forms';
|
|
|
|
|
|
|
|
|
|
|
@ -18,12 +18,17 @@ export class UserService {
|
|
|
|
return this.http.get(`${this.API_URL}/Users`);
|
|
|
|
return this.http.get(`${this.API_URL}/Users`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
postUser(form: NgForm): void {
|
|
|
|
postUser(form: NgForm): Observable<HttpResponse<Response>> {
|
|
|
|
let body = {
|
|
|
|
let body = {
|
|
|
|
login: form.value.login,
|
|
|
|
login: form.value.login,
|
|
|
|
password: form.value.password,
|
|
|
|
password: form.value.password,
|
|
|
|
permissions: 0,
|
|
|
|
permissions: 0,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.http.post<any>(`${this.API_URL}/users`, body).subscribe();
|
|
|
|
|
|
|
|
|
|
|
|
return this.http.post<any>(`${this.API_URL}/users`, body);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type Response = {
|
|
|
|
|
|
|
|
success: boolean;
|
|
|
|
|
|
|
|
};
|
|
|
|