46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import { UserListingModel } from '../../shared/components/criteria/models/errormodel/users/userListingModel';
|
|
import 'rxjs/add/operator/map';
|
|
|
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { Observable } from 'rxjs/Observable';
|
|
|
|
import { DataTableRequest } from '../../models/data-table/dataTableRequest';
|
|
import { DataTableData } from '../../models/data-table/dataTableData';
|
|
import { MyHttpService } from 'app/utilities/httpservice/myhttpservice.service';
|
|
import { HostConfiguration } from 'app/app.constants';
|
|
|
|
@Injectable()
|
|
export class UserReferenceService {
|
|
|
|
private actionUrl: string;
|
|
private headers: HttpHeaders;
|
|
|
|
constructor(private http: MyHttpService) {
|
|
|
|
this.actionUrl = HostConfiguration.Server + 'api/user/';
|
|
|
|
this.headers = new HttpHeaders();
|
|
this.headers = this.headers.set('Content-Type', 'application/json');
|
|
this.headers = this.headers.set('Accept', 'application/json');
|
|
}
|
|
|
|
// formatItem(utilities: Utilities, item: ConfigurationModel): ConfigurationModel {
|
|
// item.validFrom = new Date(item.validFrom);
|
|
// item.validTo = new Date(item.validTo);
|
|
// return item
|
|
// }
|
|
|
|
getPaged(dataTableRequest: DataTableRequest): Observable<DataTableData<UserListingModel>> {
|
|
return this.http.post<DataTableData<UserListingModel>>(this.actionUrl + 'getPaged', JSON.stringify(dataTableRequest), { headers: this.headers });
|
|
}
|
|
|
|
updateRoles(itemToUpdate: UserListingModel): Observable<UserListingModel> {
|
|
return this.http.post<UserListingModel>(this.actionUrl + 'updateRoles', JSON.stringify(itemToUpdate), { headers: this.headers });
|
|
}
|
|
|
|
delete(id: String): Observable<any> {
|
|
return this.http.delete<any>(this.actionUrl + id, { headers: this.headers });
|
|
}
|
|
}
|