♻️ refactor: Refactor API endpoints to use dynamic API prefix from environment variables
- Updated all service files to replace hardcoded API paths with `${import.meta.env.VITE_API_PREFIX}` for better configurability.
- Ensured consistency across user, common, and gateway services by applying the new API prefix format.
- Removed unnecessary comments and maintained ESLint disable directives where applicable.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
//
|
||||
/* eslint-disable */
|
||||
import request from "@workspace/ui/lib/request";
|
||||
|
||||
@@ -9,7 +8,7 @@ export async function queryIpLocation(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.QueryIPLocationResponse }>(
|
||||
"/api/v1/admin/tool/ip/location",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/tool/ip/location`,
|
||||
{
|
||||
method: "GET",
|
||||
params: {
|
||||
@@ -23,7 +22,7 @@ export async function queryIpLocation(
|
||||
/** Get System Log GET /v1/admin/tool/log */
|
||||
export async function getSystemLog(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.LogResponse }>(
|
||||
"/api/v1/admin/tool/log",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/tool/log`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -33,16 +32,19 @@ export async function getSystemLog(options?: { [key: string]: any }) {
|
||||
|
||||
/** Restart System GET /v1/admin/tool/restart */
|
||||
export async function restartSystem(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: any }>("/api/v1/admin/tool/restart", {
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Get Version GET /v1/admin/tool/version */
|
||||
export async function getVersion(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.VersionResponse }>(
|
||||
"/api/v1/admin/tool/version",
|
||||
return request<API.Response & { data?: any }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/tool/restart`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/** Get Version GET /v1/admin/tool/version */
|
||||
export async function getVersion(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.VersionResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/tool/version`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
|
||||
Reference in New Issue
Block a user