src/app/shared/api/user.service.ts
Methods |
constructor(http: HttpClient)
|
||||||
Defined in src/app/shared/api/user.service.ts:10
|
||||||
Parameters :
|
create | ||||||
create(user: UserFormModel)
|
||||||
Defined in src/app/shared/api/user.service.ts:25
|
||||||
Parameters :
Returns :
any
|
delete | ||||||
delete(username: string)
|
||||||
Defined in src/app/shared/api/user.service.ts:17
|
||||||
Parameters :
Returns :
any
|
get | ||||||
get(username: string)
|
||||||
Defined in src/app/shared/api/user.service.ts:21
|
||||||
Parameters :
Returns :
any
|
list |
list()
|
Defined in src/app/shared/api/user.service.ts:13
|
Returns :
any
|
update | ||||||
update(user: UserFormModel)
|
||||||
Defined in src/app/shared/api/user.service.ts:29
|
||||||
Parameters :
Returns :
any
|
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { UserFormModel } from '../../core/auth/user-form/user-form.model';
import { ApiModule } from './api.module';
@Injectable({
providedIn: ApiModule
})
export class UserService {
constructor(private http: HttpClient) {}
list() {
return this.http.get('api/user');
}
delete(username: string) {
return this.http.delete(`api/user/${username}`);
}
get(username: string) {
return this.http.get(`api/user/${username}`);
}
create(user: UserFormModel) {
return this.http.post(`api/user`, user);
}
update(user: UserFormModel) {
return this.http.put(`api/user/${user.username}`, user);
}
}