File tree Expand file tree Collapse file tree
kyuubi-server/web-ui/src/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import { useAuthStore } from '@/pinia/auth/auth'
1919
2020interface RequestConfig {
2121 url : string
22- method : string
22+ method : 'get' | 'post' | 'put' | 'delete'
2323 data ?: unknown
2424 params ?: Record < string , any >
2525 auth ?: { username : string ; password : string }
@@ -43,7 +43,8 @@ async function request(config: RequestConfig): Promise<unknown> {
4343 headers [ 'Content-Type' ] = 'application/json'
4444 }
4545
46- let fullUrl = url
46+ // Ensure absolute path to avoid resolving relative to the app's base path (/ui/)
47+ let fullUrl = url . startsWith ( '/' ) ? url : `/${ url } `
4748 if ( params ) {
4849 const searchParams = new URLSearchParams ( )
4950 for ( const [ key , value ] of Object . entries ( params ) ) {
@@ -53,7 +54,7 @@ async function request(config: RequestConfig): Promise<unknown> {
5354 }
5455 const queryString = searchParams . toString ( )
5556 if ( queryString ) {
56- fullUrl = `${ url } ?${ queryString } `
57+ fullUrl = `${ fullUrl } ?${ queryString } `
5758 }
5859 }
5960
@@ -77,7 +78,8 @@ async function request(config: RequestConfig): Promise<unknown> {
7778 return undefined
7879 }
7980
80- return response . json ( )
81+ const text = await response . text ( )
82+ return text ? JSON . parse ( text ) : undefined
8183}
8284
8385export default request
You can’t perform that action at this time.
0 commit comments