fix(create-app): add deprecatedAppRoutes
This commit is contained in:
@@ -8,7 +8,9 @@ import {
|
||||
import { apis } from './apis';
|
||||
import * as plugins from './plugins';
|
||||
import { AppSidebar } from './sidebar';
|
||||
import { AppRoutes } from './components/AppRoutes';
|
||||
import { Route, Routes, Navigate } from 'react-router';
|
||||
import { Router as CatalogRouter } from '@backstage/plugin-catalog';
|
||||
import { EntityPage } from './components/catalog/EntityPage';
|
||||
|
||||
const app = createApp({
|
||||
apis,
|
||||
@@ -17,6 +19,7 @@ const app = createApp({
|
||||
|
||||
const AppProvider = app.getProvider();
|
||||
const AppRouter = app.getRouter();
|
||||
const deprecatedAppRoutes = app.getRoutes();
|
||||
|
||||
const App: FC<{}> = () => (
|
||||
<AppProvider>
|
||||
@@ -25,7 +28,14 @@ const App: FC<{}> = () => (
|
||||
<AppRouter>
|
||||
<SidebarPage>
|
||||
<AppSidebar />
|
||||
<AppRoutes />
|
||||
<Routes>
|
||||
<Route
|
||||
path="/catalog/*"
|
||||
element={<CatalogRouter EntityPage={EntityPage} />}
|
||||
/>
|
||||
<Navigate key="/" to="/catalog" />
|
||||
{deprecatedAppRoutes}
|
||||
</Routes>
|
||||
</SidebarPage>
|
||||
</AppRouter>
|
||||
</AppProvider>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Routes, Route, Navigate } from 'react-router';
|
||||
import { CatalogRouter } from '@backstage/plugin-catalog';
|
||||
import { EntityPage } from './catalog/EntityPage';
|
||||
|
||||
export const AppRoutes = () => (
|
||||
<Routes>
|
||||
<Route
|
||||
path="/catalog/*"
|
||||
element={<CatalogRouter EntityPage={EntityPage} />}
|
||||
/>
|
||||
<Route path="/" element={<Navigate to="/catalog" />} />
|
||||
</Routes>
|
||||
);
|
||||
Reference in New Issue
Block a user