🐛 fix: update API prefix handling to ensure compatibility with undefined VITE_API_PREFIX

This commit is contained in:
web
2025-12-12 09:11:42 -08:00
parent 6a70eab2e9
commit 3920c6ff59
29 changed files with 311 additions and 251 deletions
+4 -4
View File
@@ -8,7 +8,7 @@ export async function queryIpLocation(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: API.QueryIPLocationResponse }>(
`${import.meta.env.VITE_API_PREFIX}/v1/admin/tool/ip/location`,
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/tool/ip/location`,
{
method: "GET",
params: {
@@ -22,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 }>(
`${import.meta.env.VITE_API_PREFIX}/v1/admin/tool/log`,
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/tool/log`,
{
method: "GET",
...(options || {}),
@@ -33,7 +33,7 @@ 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 }>(
`${import.meta.env.VITE_API_PREFIX}/v1/admin/tool/restart`,
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/tool/restart`,
{
method: "GET",
...(options || {}),
@@ -44,7 +44,7 @@ export async function restartSystem(options?: { [key: string]: any }) {
/** 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`,
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/tool/version`,
{
method: "GET",
...(options || {}),