🐛 fix: update API prefix handling to ensure compatibility with undefined VITE_API_PREFIX
This commit is contained in:
@@ -7,7 +7,7 @@ export async function closeOrder(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/public/order/close`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/order/close`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -26,7 +26,7 @@ export async function queryOrderDetail(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.OrderDetail }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/public/order/detail`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/order/detail`,
|
||||
{
|
||||
method: "GET",
|
||||
params: {
|
||||
@@ -44,7 +44,7 @@ export async function queryOrderList(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.QueryOrderListResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/public/order/list`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/order/list`,
|
||||
{
|
||||
method: "GET",
|
||||
params: {
|
||||
@@ -61,7 +61,7 @@ export async function preCreateOrder(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.PreOrderResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/public/order/pre`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/order/pre`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -79,7 +79,7 @@ export async function purchase(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.PurchaseOrderResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/public/order/purchase`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/order/purchase`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -97,7 +97,7 @@ export async function recharge(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.RechargeOrderResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/public/order/recharge`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/order/recharge`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -115,7 +115,7 @@ export async function renewal(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.RenewalOrderResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/public/order/renewal`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/order/renewal`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -133,7 +133,7 @@ export async function resetTraffic(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.ResetTrafficOrderResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/public/order/reset`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/order/reset`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user