blob: bd44a63dbfe1c5cf05b024d1bf9ec72b89b2144f (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
|
import { Injectable } from '@angular/core';
import { RdpCrudInterface } from 'portalsdk-tag-lib';
import { AdminService } from '../admin.service';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class RoleFunctionsService implements RdpCrudInterface {
public statusResponse = new BehaviorSubject("");
public updatedData = new BehaviorSubject<any>({});
loadTableData(filter: any, sortActive: any, sortDirection: any, pageIndex: any, pageSize: any): import("rxjs").Observable<any[]> {
throw new Error("Method not implemented.");
}
getTotalRowCount() {
throw new Error("Method not implemented.");
}
constructor(private adminService: AdminService) { }
add(data: any) {
//console.log("Add method is getting called from RoleFunctionService data:: ", data);
}
update(data: any): any {
console.log("Update method is getting called from RoleFunctionService data:: ", data);
return this.adminService.saveRoleFunction(data).subscribe(response => {
//console.log("Success Response ", response);
this.statusResponse.next("200");
}, error => {
console.log("Error ", error);
})
}
delete(data: any) {
//console.log("Delete method is getting called from RoleFunctionService data::>> " + JSON.stringify(data));
this.adminService.deleteRoleFunction(data).subscribe(response => {
//console.log("Repsonse : ", response);
this.statusResponse.next("200");
})
}
get() {
let response = this.adminService.getRoleFunctionList();
let editedData;
response.subscribe(res => {
editedData = res;
let data = JSON.parse(JSON.parse(editedData.data).availableRoleFunctions);
//console.log("Get Method called : ", data);
this.updatedData.next(data);
})
}
}
|