♻️ 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:
web@ppanel
2025-12-11 03:58:26 +00:00
parent 99e7f6062d
commit ae5e95477c
45 changed files with 676 additions and 551 deletions
+25 -20
View File
@@ -1,4 +1,3 @@
//
/* eslint-disable */
import request from "@workspace/ui/lib/request";
@@ -7,14 +6,17 @@ export async function updateUserTicketStatus(
body: API.UpdateUserTicketStatusRequest,
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>("/api/v1/public/ticket/", {
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
});
return request<API.Response & { data?: any }>(
`${import.meta.env.VITE_API_PREFIX}/v1/public/ticket/`,
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
}
);
}
/** Create ticket POST /v1/public/ticket/ */
@@ -22,14 +24,17 @@ export async function createUserTicket(
body: API.CreateUserTicketRequest,
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>("/api/v1/public/ticket/", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
});
return request<API.Response & { data?: any }>(
`${import.meta.env.VITE_API_PREFIX}/v1/public/ticket/`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
}
);
}
/** Get ticket detail GET /v1/public/ticket/detail */
@@ -39,7 +44,7 @@ export async function getUserTicketDetails(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: API.Ticket }>(
"/api/v1/public/ticket/detail",
`${import.meta.env.VITE_API_PREFIX}/v1/public/ticket/detail`,
{
method: "GET",
params: {
@@ -56,7 +61,7 @@ export async function createUserTicketFollow(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>(
"/api/v1/public/ticket/follow",
`${import.meta.env.VITE_API_PREFIX}/v1/public/ticket/follow`,
{
method: "POST",
headers: {
@@ -75,7 +80,7 @@ export async function getUserTicketList(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: API.GetUserTicketListResponse }>(
"/api/v1/public/ticket/list",
`${import.meta.env.VITE_API_PREFIX}/v1/public/ticket/list`,
{
method: "GET",
params: {