mirror of
https://gitee.com/pnoker/iot-dc3.git
synced 2026-11-02 03:01:52 +08:00
refactor(api): extract gateway base paths to src/config/constant/api.ts
Every api/*.ts module was hardcoding the same three prefixes
('api/v3/auth', 'api/v3/data', 'api/v3/manager'). Pull them into
API_AUTH_BASE / API_DATA_BASE / API_MANAGER_BASE so the prefix lives
in one place — aligns with the other static-constant files under
src/config/constant/ and makes it trivial to retarget the gateway
mount point or add a new service base.
All 17 api files (including dashboard.ts, which used to declare local
DATA_BASE/MANAGER_BASE) now import from the shared module.
This commit is contained in:
+6
-5
@@ -15,13 +15,14 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_AUTH_BASE } from '@/config/constant/api';
|
||||
|
||||
export const addApi = (api: any) => httpPost('api/v3/auth/api/add', api);
|
||||
export const addApi = (api: any) => httpPost(`${API_AUTH_BASE}/api/add`, api);
|
||||
|
||||
export const deleteApi = (id: string) => httpPost(`api/v3/auth/api/delete/${id}`);
|
||||
export const deleteApi = (id: string) => httpPost(`${API_AUTH_BASE}/api/delete/${id}`);
|
||||
|
||||
export const updateApi = (api: any) => httpPost('api/v3/auth/api/update', api);
|
||||
export const updateApi = (api: any) => httpPost(`${API_AUTH_BASE}/api/update`, api);
|
||||
|
||||
export const getApiById = (id: string) => httpGet(`api/v3/auth/api/id/${id}`);
|
||||
export const getApiById = (id: string) => httpGet(`${API_AUTH_BASE}/api/id/${id}`);
|
||||
|
||||
export const getApiList = (query: any) => httpPost('api/v3/auth/api/list', query);
|
||||
export const getApiList = (query: any) => httpPost(`${API_AUTH_BASE}/api/list`, query);
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
|
||||
import { httpGet } from '@/api/common';
|
||||
import { API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
export const getDriverAttributeByDriverId = (id: string) => httpGet(`api/v3/manager/driver_attribute/driver_id/${id}`);
|
||||
export const getDriverAttributeByDriverId = (id: string) =>
|
||||
httpGet(`${API_MANAGER_BASE}/driver_attribute/driver_id/${id}`);
|
||||
|
||||
export const getPointAttributeByDriverId = (id: string) => httpGet(`api/v3/manager/point_attribute/driver_id/${id}`);
|
||||
export const getPointAttributeByDriverId = (id: string) =>
|
||||
httpGet(`${API_MANAGER_BASE}/point_attribute/driver_id/${id}`);
|
||||
|
||||
+9
-12
@@ -15,26 +15,23 @@
|
||||
*/
|
||||
|
||||
import { httpGet } from '@/api/common';
|
||||
import { API_DATA_BASE, API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
// Matches backend dc3-center-data /dashboard endpoints.
|
||||
const DATA_BASE = 'api/v3/data/dashboard';
|
||||
const MANAGER_BASE = 'api/v3/manager/dashboard';
|
||||
|
||||
export const statsToday = () => httpGet(`${DATA_BASE}/stats/today`);
|
||||
export const statsToday = () => httpGet(`${API_DATA_BASE}/dashboard/stats/today`);
|
||||
|
||||
export const statsTimeseries = (params: { granularity?: 'hour' | 'day'; rangeHours?: number } = {}) =>
|
||||
httpGet(`${DATA_BASE}/stats/timeseries`, { params });
|
||||
httpGet(`${API_DATA_BASE}/dashboard/stats/timeseries`, { params });
|
||||
|
||||
export const statsTop = (
|
||||
params: { dimension?: 'device' | 'point' | 'driver'; rangeHours?: number; limit?: number } = {}
|
||||
) => httpGet(`${DATA_BASE}/top`, { params });
|
||||
) => httpGet(`${API_DATA_BASE}/dashboard/top`, { params });
|
||||
|
||||
export const streamLatest = (size = 20) => httpGet(`${DATA_BASE}/stream`, { params: { size } });
|
||||
export const streamLatest = (size = 20) => httpGet(`${API_DATA_BASE}/dashboard/stream`, { params: { size } });
|
||||
|
||||
export const alertStats = () => httpGet(`${DATA_BASE}/alert/stats`);
|
||||
export const alertStats = () => httpGet(`${API_DATA_BASE}/dashboard/alert/stats`);
|
||||
|
||||
export const alertLatest = (size = 10) => httpGet(`${DATA_BASE}/alert/latest`, { params: { size } });
|
||||
export const alertLatest = (size = 10) => httpGet(`${API_DATA_BASE}/dashboard/alert/latest`, { params: { size } });
|
||||
|
||||
export const driverStats = () => httpGet(`${MANAGER_BASE}/driver/stats`);
|
||||
export const driverStats = () => httpGet(`${API_MANAGER_BASE}/dashboard/driver/stats`);
|
||||
|
||||
export const deviceStats = (topN = 10) => httpGet(`${MANAGER_BASE}/device/stats`, { params: { topN } });
|
||||
export const deviceStats = (topN = 10) => httpGet(`${API_MANAGER_BASE}/dashboard/device/stats`, { params: { topN } });
|
||||
|
||||
+15
-13
@@ -15,36 +15,38 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_DATA_BASE, API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
export const addDevice = (device: any) => httpPost('api/v3/manager/device/add', device);
|
||||
export const addDevice = (device: any) => httpPost(`${API_MANAGER_BASE}/device/add`, device);
|
||||
|
||||
export const deleteDevice = (id: string) => httpPost(`api/v3/manager/device/delete/${id}`);
|
||||
export const deleteDevice = (id: string) => httpPost(`${API_MANAGER_BASE}/device/delete/${id}`);
|
||||
|
||||
export const updateDevice = (device: any) => httpPost('api/v3/manager/device/update', device);
|
||||
export const updateDevice = (device: any) => httpPost(`${API_MANAGER_BASE}/device/update`, device);
|
||||
|
||||
export const getDeviceById = (id: string) => httpGet(`api/v3/manager/device/id/${id}`);
|
||||
export const getDeviceById = (id: string) => httpGet(`${API_MANAGER_BASE}/device/id/${id}`);
|
||||
|
||||
export const getDeviceByIds = (deviceIds: any) => httpPost('api/v3/manager/device/ids', deviceIds);
|
||||
export const getDeviceByIds = (deviceIds: any) => httpPost(`${API_MANAGER_BASE}/device/ids`, deviceIds);
|
||||
|
||||
export const getDeviceByDriverId = (driverId: string) => httpGet(`api/v3/manager/device/driver_id/${driverId}`);
|
||||
export const getDeviceByDriverId = (driverId: string) => httpGet(`${API_MANAGER_BASE}/device/driver_id/${driverId}`);
|
||||
|
||||
export const getDeviceByProfileId = (profileId: string) => httpGet(`api/v3/manager/device/profile_id/${profileId}`);
|
||||
export const getDeviceByProfileId = (profileId: string) =>
|
||||
httpGet(`${API_MANAGER_BASE}/device/profile_id/${profileId}`);
|
||||
|
||||
export const getDeviceList = (device: any) => httpPost('api/v3/manager/device/list', device);
|
||||
export const getDeviceList = (device: any) => httpPost(`${API_MANAGER_BASE}/device/list`, device);
|
||||
|
||||
export const getDeviceStatus = (device: any) => httpPost('api/v3/data/device/status/device', device);
|
||||
export const getDeviceStatus = (device: any) => httpPost(`${API_DATA_BASE}/device/status/device`, device);
|
||||
|
||||
export const getDeviceStatusByDriverId = (driverId: string) =>
|
||||
httpGet(`api/v3/data/device/status/device/driver_id/${driverId}`);
|
||||
httpGet(`${API_DATA_BASE}/device/status/device/driver_id/${driverId}`);
|
||||
|
||||
export const getDeviceStatusByProfileId = (profileId: string) =>
|
||||
httpGet(`api/v3/data/device/status/device/profile_id/${profileId}`);
|
||||
httpGet(`${API_DATA_BASE}/device/status/device/profile_id/${profileId}`);
|
||||
|
||||
export const importDeviceTemplate = (device: any) =>
|
||||
httpPost('api/v3/manager/device/export/import_template', device, { responseType: 'blob' });
|
||||
httpPost(`${API_MANAGER_BASE}/device/export/import_template`, device, { responseType: 'blob' });
|
||||
|
||||
export const importDevice = (device: any) =>
|
||||
httpPost('api/v3/manager/device/import', device, {
|
||||
httpPost(`${API_MANAGER_BASE}/device/import`, device, {
|
||||
timeout: 0,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
});
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
*/
|
||||
|
||||
import { httpPost } from '@/api/common';
|
||||
import { API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
export const getDriverDictionary = (dictionary: any) => httpPost('api/v3/manager/dictionary/driver', dictionary);
|
||||
export const getDriverDictionary = (dictionary: any) => httpPost(`${API_MANAGER_BASE}/dictionary/driver`, dictionary);
|
||||
|
||||
export const getDeviceDictionary = (dictionary: any) => httpPost('api/v3/manager/dictionary/device', dictionary);
|
||||
export const getDeviceDictionary = (dictionary: any) => httpPost(`${API_MANAGER_BASE}/dictionary/device`, dictionary);
|
||||
|
||||
export const getProfileDictionary = (dictionary: any) => httpPost('api/v3/manager/dictionary/profile', dictionary);
|
||||
export const getProfileDictionary = (dictionary: any) => httpPost(`${API_MANAGER_BASE}/dictionary/profile`, dictionary);
|
||||
|
||||
export const getPointDictionary = (dictionary: any) => httpPost('api/v3/manager/dictionary/device_point', dictionary);
|
||||
export const getPointDictionary = (dictionary: any) =>
|
||||
httpPost(`${API_MANAGER_BASE}/dictionary/device_point`, dictionary);
|
||||
|
||||
+5
-4
@@ -15,11 +15,12 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_DATA_BASE, API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
export const getDriverById = (id: string) => httpGet(`api/v3/manager/driver/id/${id}`);
|
||||
export const getDriverById = (id: string) => httpGet(`${API_MANAGER_BASE}/driver/id/${id}`);
|
||||
|
||||
export const getDriverByIds = (driverIds: any) => httpPost('api/v3/manager/driver/ids', driverIds);
|
||||
export const getDriverByIds = (driverIds: any) => httpPost(`${API_MANAGER_BASE}/driver/ids`, driverIds);
|
||||
|
||||
export const getDriverList = (driver: any) => httpPost('api/v3/manager/driver/list', driver);
|
||||
export const getDriverList = (driver: any) => httpPost(`${API_MANAGER_BASE}/driver/list`, driver);
|
||||
|
||||
export const getDriverStatus = (driver: any) => httpPost('api/v3/data/driver/status/driver', driver);
|
||||
export const getDriverStatus = (driver: any) => httpPost(`${API_DATA_BASE}/driver/status/driver`, driver);
|
||||
|
||||
+11
-8
@@ -15,24 +15,27 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
export const addDriverInfo = (driverInfo: any) => httpPost('api/v3/manager/driver_attribute_config/add', driverInfo);
|
||||
export const addDriverInfo = (driverInfo: any) =>
|
||||
httpPost(`${API_MANAGER_BASE}/driver_attribute_config/add`, driverInfo);
|
||||
|
||||
export const updateDriverInfo = (driverInfo: any) =>
|
||||
httpPost('api/v3/manager/driver_attribute_config/update', driverInfo);
|
||||
httpPost(`${API_MANAGER_BASE}/driver_attribute_config/update`, driverInfo);
|
||||
|
||||
export const getDriverInfoByDeviceIdAndAttributeId = (deviceId: string, attributeId: string) =>
|
||||
httpGet(`api/v3/manager/driver_attribute_config/device_id/${deviceId}/attribute_id/${attributeId}`);
|
||||
httpGet(`${API_MANAGER_BASE}/driver_attribute_config/device_id/${deviceId}/attribute_id/${attributeId}`);
|
||||
|
||||
export const getDriverInfoByDeviceId = (deviceId: string) =>
|
||||
httpGet(`api/v3/manager/driver_attribute_config/device_id/${deviceId}`);
|
||||
httpGet(`${API_MANAGER_BASE}/driver_attribute_config/device_id/${deviceId}`);
|
||||
|
||||
export const addPointInfo = (pointInfo: any) => httpPost('api/v3/manager/point_attribute_config/add', pointInfo);
|
||||
export const addPointInfo = (pointInfo: any) => httpPost(`${API_MANAGER_BASE}/point_attribute_config/add`, pointInfo);
|
||||
|
||||
export const updatePointInfo = (pointInfo: any) => httpPost('api/v3/manager/point_attribute_config/update', pointInfo);
|
||||
export const updatePointInfo = (pointInfo: any) =>
|
||||
httpPost(`${API_MANAGER_BASE}/point_attribute_config/update`, pointInfo);
|
||||
|
||||
export const getPointInfoByDeviceIdAndPointId = (deviceId: string, pointId: string) =>
|
||||
httpGet(`api/v3/manager/point_attribute_config/device_id/${deviceId}/point_id/${pointId}`);
|
||||
httpGet(`${API_MANAGER_BASE}/point_attribute_config/device_id/${deviceId}/point_id/${pointId}`);
|
||||
|
||||
export const getPointInfoByDeviceId = (deviceId: string) =>
|
||||
httpGet(`api/v3/manager/point_attribute_config/device_id/${deviceId}`);
|
||||
httpGet(`${API_MANAGER_BASE}/point_attribute_config/device_id/${deviceId}`);
|
||||
|
||||
+7
-6
@@ -15,15 +15,16 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_AUTH_BASE } from '@/config/constant/api';
|
||||
|
||||
export const addMenu = (menu: any) => httpPost('api/v3/auth/menu/add', menu);
|
||||
export const addMenu = (menu: any) => httpPost(`${API_AUTH_BASE}/menu/add`, menu);
|
||||
|
||||
export const deleteMenu = (id: string) => httpPost(`api/v3/auth/menu/delete/${id}`);
|
||||
export const deleteMenu = (id: string) => httpPost(`${API_AUTH_BASE}/menu/delete/${id}`);
|
||||
|
||||
export const updateMenu = (menu: any) => httpPost('api/v3/auth/menu/update', menu);
|
||||
export const updateMenu = (menu: any) => httpPost(`${API_AUTH_BASE}/menu/update`, menu);
|
||||
|
||||
export const getMenuById = (id: string) => httpGet(`api/v3/auth/menu/id/${id}`);
|
||||
export const getMenuById = (id: string) => httpGet(`${API_AUTH_BASE}/menu/id/${id}`);
|
||||
|
||||
export const getMenuList = (query: any) => httpPost('api/v3/auth/menu/list', query);
|
||||
export const getMenuList = (query: any) => httpPost(`${API_AUTH_BASE}/menu/list`, query);
|
||||
|
||||
export const getMenuTree = (query: any = {}) => httpPost('api/v3/auth/menu/tree', query);
|
||||
export const getMenuTree = (query: any = {}) => httpPost(`${API_AUTH_BASE}/menu/tree`, query);
|
||||
|
||||
+15
-14
@@ -15,36 +15,37 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_DATA_BASE, API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
export const pointAddApi = (point: any) => httpPost('api/v3/manager/point/add', point);
|
||||
export const pointAddApi = (point: any) => httpPost(`${API_MANAGER_BASE}/point/add`, point);
|
||||
|
||||
export const pointDeleteApi = (id: string) => httpPost(`api/v3/manager/point/delete/${id}`);
|
||||
export const pointDeleteApi = (id: string) => httpPost(`${API_MANAGER_BASE}/point/delete/${id}`);
|
||||
|
||||
export const getPointUpdate = (point: any) => httpPost('api/v3/manager/point/update', point);
|
||||
export const getPointUpdate = (point: any) => httpPost(`${API_MANAGER_BASE}/point/update`, point);
|
||||
|
||||
export const getPointById = (id: string) => httpGet(`api/v3/manager/point/id/${id}`);
|
||||
export const getPointById = (id: string) => httpGet(`${API_MANAGER_BASE}/point/id/${id}`);
|
||||
|
||||
export const getPointByIds = (pointIds: any) => httpPost('api/v3/manager/point/ids', pointIds);
|
||||
export const getPointByIds = (pointIds: any) => httpPost(`${API_MANAGER_BASE}/point/ids`, pointIds);
|
||||
|
||||
export const getPointList = (point: any) => httpPost('api/v3/manager/point/list', point);
|
||||
export const getPointList = (point: any) => httpPost(`${API_MANAGER_BASE}/point/list`, point);
|
||||
|
||||
export const getPointUnit = (pointIds: any) => httpPost('api/v3/manager/point/unit', pointIds);
|
||||
export const getPointUnit = (pointIds: any) => httpPost(`${API_MANAGER_BASE}/point/unit`, pointIds);
|
||||
|
||||
export const getPointByProfileId = (profileId: string) => httpGet(`api/v3/manager/point/profile_id/${profileId}`);
|
||||
export const getPointByProfileId = (profileId: string) => httpGet(`${API_MANAGER_BASE}/point/profile_id/${profileId}`);
|
||||
|
||||
export const getPointByDeviceId = (deviceId: string) => httpGet(`api/v3/manager/point/device_id/${deviceId}`);
|
||||
export const getPointByDeviceId = (deviceId: string) => httpGet(`${API_MANAGER_BASE}/point/device_id/${deviceId}`);
|
||||
|
||||
export const getPointValueLatest = (pointValue: any) => httpPost('api/v3/data/point_value/latest', pointValue);
|
||||
export const getPointValueLatest = (pointValue: any) => httpPost(`${API_DATA_BASE}/point_value/latest`, pointValue);
|
||||
|
||||
export const getPointValueList = (pointValue: any) => httpPost('api/v3/data/point_value/list', pointValue);
|
||||
export const getPointValueList = (pointValue: any) => httpPost(`${API_DATA_BASE}/point_value/list`, pointValue);
|
||||
|
||||
export const getPointValueHistory = (deviceId: number, pointId: number, count: number = 100) =>
|
||||
httpGet(`api/v3/data/point_value/history/device_id/${deviceId}/point_id/${pointId}`, {
|
||||
httpGet(`${API_DATA_BASE}/point_value/history/device_id/${deviceId}/point_id/${pointId}`, {
|
||||
params: { count },
|
||||
});
|
||||
|
||||
export const readPointValue = (pointValueReadVO: any) =>
|
||||
httpPost('api/v3/data/point_value_command/read', pointValueReadVO);
|
||||
httpPost(`${API_DATA_BASE}/point_value_command/read`, pointValueReadVO);
|
||||
|
||||
export const writePointValue = (pointValueWriteVO: any) =>
|
||||
httpPost('api/v3/data/point_value_command/write', pointValueWriteVO);
|
||||
httpPost(`${API_DATA_BASE}/point_value_command/write`, pointValueWriteVO);
|
||||
|
||||
+8
-7
@@ -15,17 +15,18 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
export const addProfile = (profile: any) => httpPost('api/v3/manager/profile/add', profile);
|
||||
export const addProfile = (profile: any) => httpPost(`${API_MANAGER_BASE}/profile/add`, profile);
|
||||
|
||||
export const deleteProfile = (id: string) => httpPost(`api/v3/manager/profile/delete/${id}`);
|
||||
export const deleteProfile = (id: string) => httpPost(`${API_MANAGER_BASE}/profile/delete/${id}`);
|
||||
|
||||
export const updateProfile = (profile: any) => httpPost('api/v3/manager/profile/update', profile);
|
||||
export const updateProfile = (profile: any) => httpPost(`${API_MANAGER_BASE}/profile/update`, profile);
|
||||
|
||||
export const getProfileById = (id: string) => httpGet(`api/v3/manager/profile/id/${id}`);
|
||||
export const getProfileById = (id: string) => httpGet(`${API_MANAGER_BASE}/profile/id/${id}`);
|
||||
|
||||
export const getProfileByIds = (profileIds: any) => httpPost('api/v3/manager/profile/ids', profileIds);
|
||||
export const getProfileByIds = (profileIds: any) => httpPost(`${API_MANAGER_BASE}/profile/ids`, profileIds);
|
||||
|
||||
export const getProfileByDeviceId = (deviceId: string) => httpGet(`api/v3/manager/profile/device_id/${deviceId}`);
|
||||
export const getProfileByDeviceId = (deviceId: string) => httpGet(`${API_MANAGER_BASE}/profile/device_id/${deviceId}`);
|
||||
|
||||
export const getProfileList = (profile: any) => httpPost('api/v3/manager/profile/list', profile);
|
||||
export const getProfileList = (profile: any) => httpPost(`${API_MANAGER_BASE}/profile/list`, profile);
|
||||
|
||||
+7
-6
@@ -15,15 +15,16 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_AUTH_BASE } from '@/config/constant/api';
|
||||
|
||||
export const addResource = (resource: any) => httpPost('api/v3/auth/resource/add', resource);
|
||||
export const addResource = (resource: any) => httpPost(`${API_AUTH_BASE}/resource/add`, resource);
|
||||
|
||||
export const deleteResource = (id: string) => httpPost(`api/v3/auth/resource/delete/${id}`);
|
||||
export const deleteResource = (id: string) => httpPost(`${API_AUTH_BASE}/resource/delete/${id}`);
|
||||
|
||||
export const updateResource = (resource: any) => httpPost('api/v3/auth/resource/update', resource);
|
||||
export const updateResource = (resource: any) => httpPost(`${API_AUTH_BASE}/resource/update`, resource);
|
||||
|
||||
export const getResourceById = (id: string) => httpGet(`api/v3/auth/resource/id/${id}`);
|
||||
export const getResourceById = (id: string) => httpGet(`${API_AUTH_BASE}/resource/id/${id}`);
|
||||
|
||||
export const getResourceList = (query: any) => httpPost('api/v3/auth/resource/list', query);
|
||||
export const getResourceList = (query: any) => httpPost(`${API_AUTH_BASE}/resource/list`, query);
|
||||
|
||||
export const getResourceTree = (query: any = {}) => httpPost('api/v3/auth/resource/tree', query);
|
||||
export const getResourceTree = (query: any = {}) => httpPost(`${API_AUTH_BASE}/resource/tree`, query);
|
||||
|
||||
+6
-5
@@ -15,13 +15,14 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_AUTH_BASE } from '@/config/constant/api';
|
||||
|
||||
export const addRole = (role: any) => httpPost('api/v3/auth/role/add', role);
|
||||
export const addRole = (role: any) => httpPost(`${API_AUTH_BASE}/role/add`, role);
|
||||
|
||||
export const deleteRole = (id: string) => httpPost(`api/v3/auth/role/delete/${id}`);
|
||||
export const deleteRole = (id: string) => httpPost(`${API_AUTH_BASE}/role/delete/${id}`);
|
||||
|
||||
export const updateRole = (role: any) => httpPost('api/v3/auth/role/update', role);
|
||||
export const updateRole = (role: any) => httpPost(`${API_AUTH_BASE}/role/update`, role);
|
||||
|
||||
export const getRoleById = (id: string) => httpGet(`api/v3/auth/role/id/${id}`);
|
||||
export const getRoleById = (id: string) => httpGet(`${API_AUTH_BASE}/role/id/${id}`);
|
||||
|
||||
export const getRoleList = (query: any) => httpPost('api/v3/auth/role/list', query);
|
||||
export const getRoleList = (query: any) => httpPost(`${API_AUTH_BASE}/role/list`, query);
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_AUTH_BASE } from '@/config/constant/api';
|
||||
|
||||
export const bindRoleResource = (body: any) => httpPost('api/v3/auth/role-resource/add', body);
|
||||
export const bindRoleResource = (body: any) => httpPost(`${API_AUTH_BASE}/role-resource/add`, body);
|
||||
|
||||
export const unbindRoleResource = (id: string) => httpPost(`api/v3/auth/role-resource/delete/${id}`);
|
||||
export const unbindRoleResource = (id: string) => httpPost(`${API_AUTH_BASE}/role-resource/delete/${id}`);
|
||||
|
||||
export const getRoleResourceList = (query: any) => httpPost('api/v3/auth/role-resource/list', query);
|
||||
export const getRoleResourceList = (query: any) => httpPost(`${API_AUTH_BASE}/role-resource/list`, query);
|
||||
|
||||
export const listResourceByRoleId = (roleId: string) =>
|
||||
httpGet(`api/v3/auth/role-resource/list-resource-by-role/${roleId}`);
|
||||
httpGet(`${API_AUTH_BASE}/role-resource/list-resource-by-role/${roleId}`);
|
||||
|
||||
@@ -15,15 +15,16 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_AUTH_BASE } from '@/config/constant/api';
|
||||
|
||||
export const bindRoleUser = (body: any) => httpPost('api/v3/auth/role-user/add', body);
|
||||
export const bindRoleUser = (body: any) => httpPost(`${API_AUTH_BASE}/role-user/add`, body);
|
||||
|
||||
export const unbindRoleUser = (id: string) => httpPost(`api/v3/auth/role-user/delete/${id}`);
|
||||
export const unbindRoleUser = (id: string) => httpPost(`${API_AUTH_BASE}/role-user/delete/${id}`);
|
||||
|
||||
export const getRoleUserList = (query: any) => httpPost('api/v3/auth/role-user/list', query);
|
||||
export const getRoleUserList = (query: any) => httpPost(`${API_AUTH_BASE}/role-user/list`, query);
|
||||
|
||||
export const listRoleByUserId = (userId: string, tenantId?: string | number) => {
|
||||
// Only append numeric tenantId; string tenant names would cause Long type-mismatch on the backend.
|
||||
const query = typeof tenantId === 'number' ? `?tenantId=${tenantId}` : '';
|
||||
return httpGet(`api/v3/auth/role-user/list-role-by-user/${userId}${query}`);
|
||||
return httpGet(`${API_AUTH_BASE}/role-user/list-role-by-user/${userId}${query}`);
|
||||
};
|
||||
|
||||
+2
-1
@@ -15,5 +15,6 @@
|
||||
*/
|
||||
|
||||
import { httpPost } from '@/api/common';
|
||||
import { API_MANAGER_BASE } from '@/config/constant/api';
|
||||
|
||||
export const getFlowsList = (flowsQuery: any) => httpPost('api/v3/manager/ruleengine/flowsList', flowsQuery);
|
||||
export const getFlowsList = (flowsQuery: any) => httpPost(`${API_MANAGER_BASE}/ruleengine/flowsList`, flowsQuery);
|
||||
|
||||
+5
-4
@@ -15,12 +15,13 @@
|
||||
*/
|
||||
|
||||
import { httpPost } from '@/api/common';
|
||||
import { API_AUTH_BASE } from '@/config/constant/api';
|
||||
import type { Login } from '@/config/entity';
|
||||
|
||||
export const generateSalt = (login: Login) => httpPost('api/v3/auth/token/salt', login);
|
||||
export const generateSalt = (login: Login) => httpPost(`${API_AUTH_BASE}/token/salt`, login);
|
||||
|
||||
export const generateToken = (login: Login) => httpPost('api/v3/auth/token/generate', login);
|
||||
export const generateToken = (login: Login) => httpPost(`${API_AUTH_BASE}/token/generate`, login);
|
||||
|
||||
export const cancelToken = (login: Login) => httpPost('api/v3/auth/token/cancel', login);
|
||||
export const cancelToken = (login: Login) => httpPost(`${API_AUTH_BASE}/token/cancel`, login);
|
||||
|
||||
export const checkTokenValid = (login: Login) => httpPost('api/v3/auth/token/check', login);
|
||||
export const checkTokenValid = (login: Login) => httpPost(`${API_AUTH_BASE}/token/check`, login);
|
||||
|
||||
+7
-6
@@ -15,15 +15,16 @@
|
||||
*/
|
||||
|
||||
import { httpGet, httpPost } from '@/api/common';
|
||||
import { API_AUTH_BASE } from '@/config/constant/api';
|
||||
|
||||
export const addUser = (user: any) => httpPost('api/v3/auth/user-profile/add', user);
|
||||
export const addUser = (user: any) => httpPost(`${API_AUTH_BASE}/user-profile/add`, user);
|
||||
|
||||
export const deleteUser = (id: string) => httpPost(`api/v3/auth/user-profile/delete/${id}`);
|
||||
export const deleteUser = (id: string) => httpPost(`${API_AUTH_BASE}/user-profile/delete/${id}`);
|
||||
|
||||
export const updateUser = (user: any) => httpPost('api/v3/auth/user-profile/update', user);
|
||||
export const updateUser = (user: any) => httpPost(`${API_AUTH_BASE}/user-profile/update`, user);
|
||||
|
||||
export const getUserById = (id: string) => httpGet(`api/v3/auth/user-profile/id/${id}`);
|
||||
export const getUserById = (id: string) => httpGet(`${API_AUTH_BASE}/user-profile/id/${id}`);
|
||||
|
||||
export const getUserByName = (name: string) => httpGet(`api/v3/auth/user-profile/name/${name}`);
|
||||
export const getUserByName = (name: string) => httpGet(`${API_AUTH_BASE}/user-profile/name/${name}`);
|
||||
|
||||
export const getUserList = (query: any) => httpPost('api/v3/auth/user-profile/list', query);
|
||||
export const getUserList = (query: any) => httpPost(`${API_AUTH_BASE}/user-profile/list`, query);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2016-present the IoT DC3 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gateway-prefixed base paths for every `src/api/*.ts` module.
|
||||
* The gateway (dc3-gateway) strips the `/api/v3` prefix and routes the
|
||||
* remainder to the matching center service (auth / data / manager).
|
||||
*
|
||||
* Keep these in sync with:
|
||||
* - dc3-gateway/src/main/resources/application-*.yml (StripPrefix=2)
|
||||
* - dc3-common-constant/.../service/{Auth,Data,Manager}Constant.java
|
||||
* (SERVICE_NAME + URL_PREFIX fragments)
|
||||
*/
|
||||
export const API_AUTH_BASE = 'api/v3/auth';
|
||||
export const API_DATA_BASE = 'api/v3/data';
|
||||
export const API_MANAGER_BASE = 'api/v3/manager';
|
||||
Reference in New Issue
Block a user