♻️ 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";
|
||||
|
||||
@@ -8,7 +7,7 @@ export async function updatePaymentMethod(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.PaymentConfig }>(
|
||||
"/api/v1/admin/payment/",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/payment/`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -26,7 +25,7 @@ export async function createPaymentMethod(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.PaymentConfig }>(
|
||||
"/api/v1/admin/payment/",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/payment/`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -43,14 +42,17 @@ export async function deletePaymentMethod(
|
||||
body: API.DeletePaymentMethodRequest,
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>("/api/v1/admin/payment/", {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
return request<API.Response & { data?: any }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/payment/`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/** Get Payment Method List GET /v1/admin/payment/list */
|
||||
@@ -60,7 +62,7 @@ export async function getPaymentMethodList(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.GetPaymentMethodListResponse }>(
|
||||
"/api/v1/admin/payment/list",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/payment/list`,
|
||||
{
|
||||
method: "GET",
|
||||
params: {
|
||||
@@ -74,7 +76,7 @@ export async function getPaymentMethodList(
|
||||
/** Get supported payment platform GET /v1/admin/payment/platform */
|
||||
export async function getPaymentPlatform(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.PlatformResponse }>(
|
||||
"/api/v1/admin/payment/platform",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/payment/platform`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
|
||||
Reference in New Issue
Block a user