src/Router: use release as a basename in BrowserRouter

The insights platform is moving to react router v6, meaning router
contexts can no longer be nested. As a result all applications will end
up sharing the same `BrowserRouter`.

Switch to using the release (`/` or `/beta/`) as a basename for the
BrowserRouter, and offload the full path (`/insights/$appname`) to the
individual routes. This makes it easier to drop the BrowserRouter in
image builder for the platform one in future.
This commit is contained in:
Sanne Raymaekers 2022-10-17 12:50:13 +02:00
parent 4c1a6c223d
commit 03421acc74
8 changed files with 35 additions and 21 deletions

View file

@ -25,6 +25,7 @@ import './CreateImageWizard.scss';
import api from '../../api';
import { UNIT_GIB, UNIT_KIB, UNIT_MIB } from '../../constants';
import isRhel from '../../Utilities/isRhel';
import { resolveRelPath } from '../../Utilities/path';
const handleKeyDown = (e, handleClose) => {
if (e.key === 'Escape') {
@ -415,7 +416,7 @@ const CreateImageWizard = () => {
const initialState = requestToState(composeRequest);
const stepHistory = formStepHistory(composeRequest);
const handleClose = () => navigate('/');
const handleClose = () => navigate(resolveRelPath(''));
return (
<ImageCreator
@ -440,7 +441,7 @@ const CreateImageWizard = () => {
)
)
.then(() => {
navigate('/');
navigate(resolveRelPath(''));
dispatch(
addNotification({
variant: 'success',