ui: fix DashboardRouter trailing slashes

This commit is contained in:
Matthew Penner 2023-01-13 11:58:40 -07:00
parent b59e1da860
commit e88197c4b1
No known key found for this signature in database

View file

@ -21,7 +21,7 @@ function DashboardRouter() {
{routes.account {routes.account
.filter(route => route.path !== undefined) .filter(route => route.path !== undefined)
.map(({ path, name, end = false }) => ( .map(({ path, name, end = false }) => (
<NavLink key={path} to={`/account/${path ?? ''}`.replace('//', '/')} end={end}> <NavLink key={path} to={`/account/${path ?? ''}`.replace(/\/$/, '')} end={end}>
{name} {name}
</NavLink> </NavLink>
))} ))}
@ -34,7 +34,7 @@ function DashboardRouter() {
<Route path="" element={<DashboardContainer />} /> <Route path="" element={<DashboardContainer />} />
{routes.account.map(({ route, component: Component }) => ( {routes.account.map(({ route, component: Component }) => (
<Route key={route} path={`/account/${route}`.replace('//', '/')} element={<Component />} /> <Route key={route} path={`/account/${route}`.replace(/\/$/, '')} element={<Component />} />
))} ))}
<Route path="*" element={<NotFound />} /> <Route path="*" element={<NotFound />} />