🐛 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 updateDocument(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/document/`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/document/`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -25,7 +25,7 @@ export async function createDocument(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/document/`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/document/`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -43,7 +43,7 @@ export async function deleteDocument(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/document/`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/document/`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
@@ -61,7 +61,7 @@ export async function batchDeleteDocument(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/document/batch`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/document/batch`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
@@ -76,7 +76,7 @@ export async function batchDeleteDocument(
|
||||
/** Get document detail GET /v1/admin/document/detail */
|
||||
export async function getDocumentDetail(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.Document }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/document/detail`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/document/detail`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -91,7 +91,7 @@ export async function getDocumentList(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: API.GetDocumentListResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/document/list`,
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/document/list`,
|
||||
{
|
||||
method: "GET",
|
||||
params: {
|
||||
|
||||
Reference in New Issue
Block a user