Skip to content

Commit a46e3a2

Browse files
authored
fix: use window.location.origin as fallback for API URL copy (#15220)
In the API tab, if a `serverURL` wasn't provided in the Payload config, the URL shown would be relative. This fix uses `window.location.origin` as a fallback if `serverURL` is not provided. <img width="737" height="229" alt="image" src="https://github.com/user-attachments/assets/7d36843b-1edc-447b-83c4-677df5e0c784" />
1 parent f1f2be6 commit a46e3a2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

packages/next/src/views/API/index.client.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const APIViewClient: React.FC = () => {
3838
defaultDepth,
3939
localization,
4040
routes: { api: apiRoute },
41+
serverURL,
4142
},
4243
getEntityConfig,
4344
} = useConfig()
@@ -83,6 +84,7 @@ export const APIViewClient: React.FC = () => {
8384
const fetchURL = formatAdminURL({
8485
apiRoute,
8586
path: `${docEndpoint}?${params}`,
87+
serverURL: serverURL || window.location.origin,
8688
})
8789

8890
React.useEffect(() => {

0 commit comments

Comments
 (0)