penyesuaian service
This commit is contained in:
parent
89203b9984
commit
f36c8d0240
|
@ -10,19 +10,22 @@ const BASE_URL = 'https://kapi.absys.ninja/hemat';
|
|||
export class DeviceService {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getDeviceData(id, category, status): Observable<any> {
|
||||
getDeviceData(id, category = "0", status = "0"): Observable<any> {
|
||||
const endpoint = `/devices`;
|
||||
const params = new URLSearchParams({
|
||||
page: "1",
|
||||
limit: "100",
|
||||
building_id: id
|
||||
building_id: id,
|
||||
category_id: category,
|
||||
status_id: status,
|
||||
room_id: "0"
|
||||
});
|
||||
if (category) {
|
||||
params.append("category_id", category);
|
||||
}
|
||||
if (status) {
|
||||
params.append("status_id", status);
|
||||
}
|
||||
// if (category) {
|
||||
// params.append("category_id", category);
|
||||
// }
|
||||
// if (status) {
|
||||
// params.append("status_id", status);
|
||||
// }
|
||||
const url = `${BASE_URL}${endpoint}?${params.toString()}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
|
|
Loading…
Reference in New Issue