fix(next): folder redirects not working (#12509)
This commit is contained in:
@@ -88,7 +88,7 @@ export const buildBrowseByFolderView = async (
|
||||
((resolvedFolderID && folderID && folderID !== resolvedFolderID) ||
|
||||
(folderID && !resolvedFolderID))
|
||||
) {
|
||||
return redirect(
|
||||
redirect(
|
||||
formatAdminURL({
|
||||
adminRoute,
|
||||
path: config.admin.routes.browseByFolder,
|
||||
|
||||
@@ -11,6 +11,9 @@ export const BrowseByFolder: React.FC<BuildFolderViewArgs> = async (args) => {
|
||||
const { View } = await buildBrowseByFolderView(args)
|
||||
return View
|
||||
} catch (error) {
|
||||
if (error?.message === 'NEXT_REDIRECT') {
|
||||
throw error
|
||||
}
|
||||
if (error.message === 'not-found') {
|
||||
notFound()
|
||||
} else {
|
||||
|
||||
@@ -124,7 +124,7 @@ export const buildCollectionFolderView = async (
|
||||
((resolvedFolderID && folderID && folderID !== resolvedFolderID) ||
|
||||
(folderID && !resolvedFolderID))
|
||||
) {
|
||||
return redirect(
|
||||
redirect(
|
||||
formatAdminURL({
|
||||
adminRoute,
|
||||
path: `/collections/${collectionSlug}/${config.folders.slug}`,
|
||||
|
||||
@@ -11,6 +11,9 @@ export const CollectionFolderView: React.FC<BuildCollectionFolderViewStateArgs>
|
||||
const { View } = await buildCollectionFolderView(args)
|
||||
return View
|
||||
} catch (error) {
|
||||
if (error?.message === 'NEXT_REDIRECT') {
|
||||
throw error
|
||||
}
|
||||
if (error.message === 'not-found') {
|
||||
notFound()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user