mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
fix(console): get prefixed router basename in local dev env
This commit is contained in:
parent
7064023194
commit
ccbe5dab2d
2 changed files with 9 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { getBasename, UserScope } from '@logto/core-kit';
|
import { UserScope } from '@logto/core-kit';
|
||||||
import { LogtoProvider } from '@logto/react';
|
import { LogtoProvider } from '@logto/react';
|
||||||
import { adminConsoleApplicationId, managementResource } from '@logto/schemas/lib/seeds';
|
import { adminConsoleApplicationId, managementResource } from '@logto/schemas/lib/seeds';
|
||||||
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
|
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
|
||||||
|
@ -31,6 +31,8 @@ import UserDetails from '@/pages/UserDetails';
|
||||||
import Users from '@/pages/Users';
|
import Users from '@/pages/Users';
|
||||||
import Welcome from '@/pages/Welcome';
|
import Welcome from '@/pages/Welcome';
|
||||||
|
|
||||||
|
import { getBasename } from './utilities/router';
|
||||||
|
|
||||||
void initI18n();
|
void initI18n();
|
||||||
|
|
||||||
const Main = () => {
|
const Main = () => {
|
||||||
|
|
6
packages/console/src/utilities/router.ts
Normal file
6
packages/console/src/utilities/router.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export const getBasename = (prefix: string, developmentPort: string): string => {
|
||||||
|
const isBasenameNeeded =
|
||||||
|
process.env.NODE_ENV !== 'development' || process.env.PORT === developmentPort;
|
||||||
|
|
||||||
|
return isBasenameNeeded ? '/' + prefix : '';
|
||||||
|
};
|
Loading…
Reference in a new issue