Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
31 lines
801 B
Plaintext
31 lines
801 B
Plaintext
import { getRouteWithoutAdmin } from './getRouteWithoutAdmin.js';
|
|
/**
|
|
* Returns an array of views marked with 'public: true' in the config
|
|
*/
|
|
export const isCustomAdminView = ({
|
|
adminRoute,
|
|
config,
|
|
route
|
|
}) => {
|
|
if (config.admin?.components?.views) {
|
|
const isPublicAdminRoute = Object.entries(config.admin.components.views).some(([_, view]) => {
|
|
const routeWithoutAdmin = getRouteWithoutAdmin({
|
|
adminRoute,
|
|
route
|
|
});
|
|
if (view.exact) {
|
|
if (routeWithoutAdmin === view.path) {
|
|
return true;
|
|
}
|
|
} else {
|
|
if (routeWithoutAdmin.startsWith(view.path)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
return isPublicAdminRoute;
|
|
}
|
|
return false;
|
|
};
|
|
//# sourceMappingURL=isCustomAdminView.js.map |