refactor: Simplify audio URL handling in jobApi by removing redundant base URL concatenation
This commit is contained in:
@@ -344,16 +344,14 @@ export const jobApi = {
|
|||||||
if (audioPath.startsWith('http')) {
|
if (audioPath.startsWith('http')) {
|
||||||
if (audioPath.includes('localhost') || audioPath.includes('127.0.0.1')) {
|
if (audioPath.includes('localhost') || audioPath.includes('127.0.0.1')) {
|
||||||
const url = new URL(audioPath)
|
const url = new URL(audioPath)
|
||||||
return `${import.meta.env.VITE_API_URL}${url.pathname}`
|
return url.pathname
|
||||||
}
|
}
|
||||||
return audioPath
|
return audioPath
|
||||||
} else {
|
} else {
|
||||||
const baseUrl = import.meta.env.VITE_API_URL
|
return audioPath.startsWith('/') ? audioPath : `/${audioPath}`
|
||||||
const normalizedPath = audioPath.startsWith('/') ? audioPath : `/${audioPath}`
|
|
||||||
return `${baseUrl}${normalizedPath}`
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return `${import.meta.env.VITE_API_URL}${API_ENDPOINTS.JOBS.AUDIO(id)}`
|
return API_ENDPOINTS.JOBS.AUDIO(id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user