Skip to content

Commit

Permalink
refactor(console): refactor some console global routes (#5841)
Browse files Browse the repository at this point in the history
  • Loading branch information
charIeszhao authored May 10, 2024
1 parent 266af8c commit dc0d577
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/console/src/cloud/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AcceptInvitation from '@/pages/AcceptInvitation';
import Callback from '@/pages/Callback';
import CheckoutSuccessCallback from '@/pages/CheckoutSuccessCallback';
import Profile from '@/pages/Profile';
import HandleSocialCallback from '@/pages/Profile/containers/HandleSocialCallback';

import * as styles from './AppRoutes.module.scss';
import Main from './pages/Main';
Expand All @@ -20,10 +21,11 @@ function AppRoutes() {
<Route path={GlobalAnonymousRoute.SocialDemoCallback} element={<SocialDemoCallback />} />
<Route element={<ProtectedRoutes />}>
<Route
path={`${GlobalRoute.AcceptInvitation}/:invitationId`}
path={`${GlobalAnonymousRoute.AcceptInvitation}/:invitationId`}
element={<AcceptInvitation />}
/>
<Route path={GlobalAnonymousRoute.Profile + '/*'} element={<Profile />} />
<Route path="/handle-social" element={<HandleSocialCallback />} />
<Route path={GlobalRoute.CheckoutSuccessCallback} element={<CheckoutSuccessCallback />} />
<Route index element={<Main />} />
</Route>
Expand Down
7 changes: 4 additions & 3 deletions packages/console/src/containers/ConsoleRoutes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ export function ConsoleRoutes() {
* console path to trigger the console routes.
*/}
{!isCloud && <Route path="/" element={<Navigate to={ossConsolePath} />} />}
{!isCloud && (
<Route path={ossConsolePath + GlobalAnonymousRoute.Profile + '/*'} element={<Profile />} />
)}
<Route path="/:tenantId" element={<Layout />}>
<Route path="callback" element={<Callback />} />
<Route path="welcome" element={<Welcome />} />
<Route element={<ProtectedRoutes />}>
<Route
path={dropLeadingSlash(GlobalAnonymousRoute.Profile) + '/*'}
element={<Profile />}
/>
<Route path="handle-social" element={<HandleSocialCallback />} />
<Route element={<TenantAccess />}>
{isCloud && (
Expand Down
2 changes: 1 addition & 1 deletion packages/console/src/contexts/TenantsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { isCloud } from '@/consts/env';
export enum GlobalAnonymousRoute {
Callback = '/callback',
SocialDemoCallback = '/social-demo-callback',
AcceptInvitation = '/accept',
Profile = '/profile',
}

Expand All @@ -29,7 +30,6 @@ export enum GlobalAnonymousRoute {
*/
export enum GlobalRoute {
CheckoutSuccessCallback = '/checkout-success-callback',
AcceptInvitation = '/accept',
}

const reservedRoutes: Readonly<string[]> = Object.freeze([
Expand Down

0 comments on commit dc0d577

Please sign in to comment.