app,create-app: fix index path redirect

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-08-07 14:12:07 +02:00
parent 3626576230
commit 362ea5a728
4 changed files with 15 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
---
'@backstage/create-app': patch
---
Updated the index page redirect to work with apps served on a different base path than `/`.
To apply this change to an existing app, remove the `/` prefix from the target route in the `Navigate` element in `packages/app/src/App.tsx`:
```diff
-<Navigate key="/" to="/catalog" />
+<Navigate key="/" to="catalog" />
```
@@ -187,7 +187,7 @@ new `CustomCatalogIndexPage`.
# packages/app/src/App.tsx
const routes = (
<FlatRoutes>
<Navigate key="/" to="/catalog" />
<Navigate key="/" to="catalog" />
- <Route path="/catalog" element={<CatalogIndexPage />} />
+ <Route path="/catalog" element={<CustomCatalogIndexPage />} />
```
+1 -1
View File
@@ -98,7 +98,7 @@ const AppRouter = app.getRouter();
const routes = (
<FlatRoutes>
<Navigate key="/" to="/catalog" />
<Navigate key="/" to="catalog" />
<Route path="/catalog" element={<CatalogIndexPage />} />
<Route
path="/catalog/:namespace/:kind/:name"
@@ -42,7 +42,7 @@ const AppRouter = app.getRouter();
const routes = (
<FlatRoutes>
<Navigate key="/" to="/catalog" />
<Navigate key="/" to="catalog" />
<Route path="/catalog" element={<CatalogIndexPage />} />
<Route
path="/catalog/:namespace/:kind/:name"