Files
iot-dc3/src/api/role.ts
T
pnoker cc16cd08b6 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.
2026-05-02 14:12:17 +08:00

29 lines
1.2 KiB
TypeScript

/*
* 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.
*/
import { httpGet, httpPost } from '@/api/common';
import { API_AUTH_BASE } from '@/config/constant/api';
export const addRole = (role: any) => httpPost(`${API_AUTH_BASE}/role/add`, role);
export const deleteRole = (id: string) => httpPost(`${API_AUTH_BASE}/role/delete/${id}`);
export const updateRole = (role: any) => httpPost(`${API_AUTH_BASE}/role/update`, role);
export const getRoleById = (id: string) => httpGet(`${API_AUTH_BASE}/role/id/${id}`);
export const getRoleList = (query: any) => httpPost(`${API_AUTH_BASE}/role/list`, query);