Skip to content

Commit 9d2817e

Browse files
authored
fix: ensure redirect route is correctly formatted for "Copy to locale" (#12560)
1 parent 254ffec commit 9d2817e

File tree

1 file changed

+6
-1
lines changed
  • packages/ui/src/elements/CopyLocaleData

1 file changed

+6
-1
lines changed

packages/ui/src/elements/CopyLocaleData/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useModal } from '@faceless-ui/modal'
44
import { getTranslation } from '@payloadcms/translations'
55
import { useRouter } from 'next/navigation.js'
6+
import { formatAdminURL } from 'payload/shared'
67
import React, { useCallback } from 'react'
78
import { toast } from 'sonner'
89

@@ -82,7 +83,11 @@ export const CopyLocaleData: React.FC = () => {
8283

8384
startRouteTransition(() =>
8485
router.push(
85-
`${serverURL}${admin}/${collectionSlug ? `collections/${collectionSlug}/${id}` : `globals/${globalSlug}`}?locale=${to}`,
86+
formatAdminURL({
87+
adminRoute: admin,
88+
path: `/${collectionSlug ? `collections/${collectionSlug}/${id}` : `globals/${globalSlug}`}`,
89+
serverURL,
90+
}) + `?locale=${to}`,
8691
),
8792
)
8893

0 commit comments

Comments
 (0)