fix(create-app): add deprecatedAppRoutes

This commit is contained in:
Ivan Shmidt
2020-09-02 16:31:04 +02:00
parent 217c7094db
commit 73aa8b990c
2 changed files with 12 additions and 16 deletions
@@ -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>
);