File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ export const initPage = async ({
99
99
const globalSlug = entityType === 'globals' ? entitySlug : undefined
100
100
const docID = collectionSlug && createOrID !== 'create' ? createOrID : undefined
101
101
102
+ const isAdminRoute = route . startsWith ( adminRoute )
102
103
const isAuthRoute = authRoutes . some ( ( r ) => r === route . replace ( adminRoute , '' ) )
103
104
104
105
if ( redirectUnauthenticatedUser && ! user && ! isAuthRoute ) {
@@ -111,7 +112,7 @@ export const initPage = async ({
111
112
redirect ( `${ routes . admin } /login?redirect=${ route + stringifiedSearchParams } ` )
112
113
}
113
114
114
- if ( ! permissions . canAccessAdmin && ! isAuthRoute ) {
115
+ if ( ! permissions . canAccessAdmin && isAdminRoute && ! isAuthRoute ) {
115
116
notFound ( )
116
117
}
117
118
Original file line number Diff line number Diff line change @@ -46,10 +46,13 @@ export const NotFoundPage = async ({
46
46
[ key : string ] : string | string [ ]
47
47
}
48
48
} ) => {
49
+ const config = await configPromise
50
+ const { routes : { admin : adminRoute } = { } } = config
51
+
49
52
const initPageResult = await initPage ( {
50
- config : configPromise ,
53
+ config,
51
54
redirectUnauthenticatedUser : true ,
52
- route : ' /not-found' ,
55
+ route : ` ${ adminRoute } /not-found` ,
53
56
searchParams,
54
57
} )
55
58
You can’t perform that action at this time.
0 commit comments