更新api.js
This commit is contained in:
25
src/api/health.js
Normal file
25
src/api/health.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import http from '../utils/http';
|
||||
import { Response } from '../enums';
|
||||
|
||||
// --- API Functions ---
|
||||
|
||||
/**
|
||||
* 检查服务进程是否运行正常,只要服务能响应就返回 200 OK。
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const getHealthz = () => {
|
||||
return http.get('/healthz');
|
||||
};
|
||||
|
||||
/**
|
||||
* 检查服务是否已准备好接收流量。当前实现为只要服务能响应即代表就绪。
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const getReadyz = () => {
|
||||
return http.get('/readyz');
|
||||
};
|
||||
|
||||
export const HealthApi = {
|
||||
getHealthz,
|
||||
getReadyz,
|
||||
};
|
||||
@@ -2,6 +2,7 @@ import { AreaControllerApi, DeviceApi } from './device.js';
|
||||
import { PlanApi } from './plan.js';
|
||||
import { UserApi } from './user.js';
|
||||
import { AlarmApi } from './alarm.js'; // 导入告警API
|
||||
import { HealthApi } from './health.js'; // 导入健康检查API
|
||||
import { DeviceTemplateApi } from './deviceTemplate.js'; // 导入设备模板API
|
||||
|
||||
/**
|
||||
@@ -13,6 +14,7 @@ export class ApiClient {
|
||||
this.devices = DeviceApi;
|
||||
this.plans = PlanApi;
|
||||
this.users = UserApi;
|
||||
this.health = HealthApi; // 添加健康检查API
|
||||
this.alarms = AlarmApi; // 添加告警API
|
||||
this.deviceTemplates = DeviceTemplateApi; // 添加设备模板API
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user