Updated AdminX routing to work with and without a leading slash (#19312)

no issue
This commit is contained in:
Jono M 2023-12-11 14:43:06 +00:00 committed by GitHub
parent d65a95836b
commit 9ff482f985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -111,7 +111,7 @@ const RoutingProvider: React.FC<RoutingProviderProps> = ({basePath, modals, chil
return;
}
const newPath = options.route;
const newPath = options.route.replace(/^\//, '');
if (newPath === route) {
// No change

View File

@ -42,7 +42,7 @@ const IntegrationItem: React.FC<IntegrationItemProps> = ({
const handleClick = () => {
if (disabled) {
updateRoute({route: 'pro'});
updateRoute({route: 'pro', isExternal: true});
} else {
action();
}

View File

@ -220,6 +220,9 @@ export default class AdminXComponent extends Component {
};
externalNavigate = ({route, models = []}) => {
if (!route.startsWith('/')) {
route = `/${route}`;
}
this.router.transitionTo(route, ...models);
};