Skip to content

Commit

Permalink
feat: Add support for complete domain names in the new URL prefix. (l…
Browse files Browse the repository at this point in the history
…anggenius#8893)

Co-authored-by: crazywoola <427733928@qq.com>
  • Loading branch information
2 people authored and JunXu01 committed Nov 9, 2024
1 parent 8f0fb9a commit 33518e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions web/service/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ const baseFetch = <T>(
}

const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX
let urlWithPrefix = `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`
let urlWithPrefix = (url.startsWith('http://') || url.startsWith('https://'))
? url
: `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`

const { method, params, body } = options
// handle query
Expand Down Expand Up @@ -494,7 +496,9 @@ export const ssePost = (
getAbortController?.(abortController)

const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX
const urlWithPrefix = `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`
const urlWithPrefix = (url.startsWith('http://') || url.startsWith('https://'))
? url
: `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`

const { body } = options
if (body)
Expand Down

0 comments on commit 33518e8

Please sign in to comment.