also check if user is able to load extensions as well as if they loaded so guest forms can work
This commit is contained in:
parent
4983d48f22
commit
7a62a8688c
|
@ -25,6 +25,9 @@ export default function ContainerForExtensions() {
|
|||
const [extensionUxElements, setExtensionNavigationItems] = useState<
|
||||
UiSchemaUxElement[] | null
|
||||
>(null);
|
||||
const [canLoadExtensions, setCanLoadExtensions] = useState<boolean | null>(
|
||||
null
|
||||
);
|
||||
|
||||
let contentClassName = 'main-site-body-centered';
|
||||
if (window.location.pathname.startsWith('/editor/')) {
|
||||
|
@ -77,10 +80,13 @@ export default function ContainerForExtensions() {
|
|||
return;
|
||||
}
|
||||
if (ability.can('GET', targetUris.extensionListPath)) {
|
||||
setCanLoadExtensions(true);
|
||||
HttpService.makeCallToBackend({
|
||||
path: targetUris.extensionListPath,
|
||||
successCallback: processExtensionResult,
|
||||
});
|
||||
} else {
|
||||
setCanLoadExtensions(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -101,7 +107,12 @@ export default function ContainerForExtensions() {
|
|||
<Routes>
|
||||
<Route
|
||||
path="/*"
|
||||
element={<BaseRoutes extensionUxElements={extensionUxElements} />}
|
||||
element={
|
||||
<BaseRoutes
|
||||
extensionUxElements={extensionUxElements}
|
||||
canLoadExtensions={canLoadExtensions}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route path="/editor/*" element={<EditorRoutes />} />
|
||||
<Route path="/extensions/:page_identifier" element={<Extension />} />
|
||||
|
|
|
@ -19,10 +19,14 @@ import { ExtensionUxElementMap } from '../components/ExtensionUxElementForDispla
|
|||
import Extension from './Extension';
|
||||
|
||||
type OwnProps = {
|
||||
canLoadExtensions: boolean | null;
|
||||
extensionUxElements?: UiSchemaUxElement[] | null;
|
||||
};
|
||||
|
||||
export default function BaseRoutes({ extensionUxElements }: OwnProps) {
|
||||
export default function BaseRoutes({
|
||||
canLoadExtensions,
|
||||
extensionUxElements,
|
||||
}: OwnProps) {
|
||||
const elementCallback = (uxElement: UiSchemaUxElement) => {
|
||||
return (
|
||||
<Route
|
||||
|
@ -32,7 +36,7 @@ export default function BaseRoutes({ extensionUxElements }: OwnProps) {
|
|||
);
|
||||
};
|
||||
|
||||
if (extensionUxElements) {
|
||||
if (extensionUxElements || canLoadExtensions === false) {
|
||||
const extensionRoutes = ExtensionUxElementMap({
|
||||
displayLocation: 'routes',
|
||||
elementCallback,
|
||||
|
|
Loading…
Reference in New Issue