forked from nuagenetworks/js-bambou
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNUHealthService.js
22 lines (20 loc) · 894 Bytes
/
NUHealthService.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import NUService from './NUService';
export default class NUHealthService extends NUService {
constructor(props) {
super(props);
const { rootURLObj } = props;
this.RESTResource = rootURLObj && rootURLObj.RESTResource ? rootURLObj.RESTResource : 'health';
this.rootURL = `${this.protocol}://${this.hostname}${this.port ? ':' + this.port : ''}/${this.RESTRoot}/${this.RESTResource}`;
}
/*
* Fetch health status.
* component: name of the server component whose status is requested
*/
fetch = (component, cancelToken) => {
const healthURL = `${this.rootURL}/?proxyRequest=false`;
const requestURL = component ? `${healthURL}&component=${component}` : healthURL;
return this.invokeRequest({verb: 'GET', requestURL, cancelToken}).then((response) => {
return response.data[0];
});
}
}