0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00

refactor(console): refactor some console global routes (#5841)

This commit is contained in:
Charles Zhao 2024-05-10 15:10:51 +08:00 committed by GitHub
parent 266af8c3d7
commit dc0d5775ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 5 deletions

View file

@ -6,6 +6,7 @@ import AcceptInvitation from '@/pages/AcceptInvitation';
import Callback from '@/pages/Callback'; import Callback from '@/pages/Callback';
import CheckoutSuccessCallback from '@/pages/CheckoutSuccessCallback'; import CheckoutSuccessCallback from '@/pages/CheckoutSuccessCallback';
import Profile from '@/pages/Profile'; import Profile from '@/pages/Profile';
import HandleSocialCallback from '@/pages/Profile/containers/HandleSocialCallback';
import * as styles from './AppRoutes.module.scss'; import * as styles from './AppRoutes.module.scss';
import Main from './pages/Main'; import Main from './pages/Main';
@ -20,10 +21,11 @@ function AppRoutes() {
<Route path={GlobalAnonymousRoute.SocialDemoCallback} element={<SocialDemoCallback />} /> <Route path={GlobalAnonymousRoute.SocialDemoCallback} element={<SocialDemoCallback />} />
<Route element={<ProtectedRoutes />}> <Route element={<ProtectedRoutes />}>
<Route <Route
path={`${GlobalRoute.AcceptInvitation}/:invitationId`} path={`${GlobalAnonymousRoute.AcceptInvitation}/:invitationId`}
element={<AcceptInvitation />} element={<AcceptInvitation />}
/> />
<Route path={GlobalAnonymousRoute.Profile + '/*'} element={<Profile />} /> <Route path={GlobalAnonymousRoute.Profile + '/*'} element={<Profile />} />
<Route path="/handle-social" element={<HandleSocialCallback />} />
<Route path={GlobalRoute.CheckoutSuccessCallback} element={<CheckoutSuccessCallback />} /> <Route path={GlobalRoute.CheckoutSuccessCallback} element={<CheckoutSuccessCallback />} />
<Route index element={<Main />} /> <Route index element={<Main />} />
</Route> </Route>

View file

@ -40,13 +40,14 @@ export function ConsoleRoutes() {
* console path to trigger the console routes. * console path to trigger the console routes.
*/} */}
{!isCloud && <Route path="/" element={<Navigate to={ossConsolePath} />} />} {!isCloud && <Route path="/" element={<Navigate to={ossConsolePath} />} />}
{!isCloud && (
<Route path={ossConsolePath + GlobalAnonymousRoute.Profile + '/*'} element={<Profile />} />
)}
<Route path="/:tenantId" element={<Layout />}> <Route path="/:tenantId" element={<Layout />}>
<Route path="callback" element={<Callback />} /> <Route path="callback" element={<Callback />} />
<Route path="welcome" element={<Welcome />} /> <Route path="welcome" element={<Welcome />} />
<Route element={<ProtectedRoutes />}> <Route element={<ProtectedRoutes />}>
<Route
path={dropLeadingSlash(GlobalAnonymousRoute.Profile) + '/*'}
element={<Profile />}
/>
<Route path="handle-social" element={<HandleSocialCallback />} /> <Route path="handle-social" element={<HandleSocialCallback />} />
<Route element={<TenantAccess />}> <Route element={<TenantAccess />}>
{isCloud && ( {isCloud && (

View file

@ -21,6 +21,7 @@ import { isCloud } from '@/consts/env';
export enum GlobalAnonymousRoute { export enum GlobalAnonymousRoute {
Callback = '/callback', Callback = '/callback',
SocialDemoCallback = '/social-demo-callback', SocialDemoCallback = '/social-demo-callback',
AcceptInvitation = '/accept',
Profile = '/profile', Profile = '/profile',
} }
@ -29,7 +30,6 @@ export enum GlobalAnonymousRoute {
*/ */
export enum GlobalRoute { export enum GlobalRoute {
CheckoutSuccessCallback = '/checkout-success-callback', CheckoutSuccessCallback = '/checkout-success-callback',
AcceptInvitation = '/accept',
} }
const reservedRoutes: Readonly<string[]> = Object.freeze([ const reservedRoutes: Readonly<string[]> = Object.freeze([