0
Fork 0
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:
Charles Zhao 2022-09-17 13:35:10 +08:00
parent 7064023194
commit ccbe5dab2d
No known key found for this signature in database
GPG key ID: 4858774754C92DF2
2 changed files with 9 additions and 1 deletions

View file

@ -1,4 +1,4 @@
import { getBasename, UserScope } from '@logto/core-kit';
import { UserScope } from '@logto/core-kit';
import { LogtoProvider } from '@logto/react';
import { adminConsoleApplicationId, managementResource } from '@logto/schemas/lib/seeds';
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
@ -31,6 +31,8 @@ import UserDetails from '@/pages/UserDetails';
import Users from '@/pages/Users';
import Welcome from '@/pages/Welcome';
import { getBasename } from './utilities/router';
void initI18n();
const Main = () => {

View 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 : '';
};