- Add @logto/react dependencies to package.json and lockfile. - Replace custom App layout with LogtoProvider for authentication handling. - Configure Logto settings (endpoint, appId) in frontend.tsx. - Refactor FindUserPage search logic to trigger request on value change instead of manual search key refresh.
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
/**
|
|
* This file is the entry point for the React app, it sets up the root
|
|
* element and renders the App component to the DOM.
|
|
*
|
|
* It is included in `src/index.html`.
|
|
*/
|
|
|
|
import { StrictMode } from "react";
|
|
import { createRoot } from "react-dom/client";
|
|
import { ConfigProvider, Empty, theme } from "antd";
|
|
import zhCN from 'antd/locale/zh_CN';
|
|
import { RouterProvider } from "react-router";
|
|
import { LogtoProvider, type LogtoConfig } from '@logto/react';
|
|
import { route } from "./routes";
|
|
|
|
const elem = document.getElementById("root")!;
|
|
|
|
const config: LogtoConfig = {
|
|
endpoint: 'https://logto.ksr.la/',
|
|
appId: 'iq0oceaeqazpcned7hzil',
|
|
};
|
|
const app = (
|
|
<StrictMode>
|
|
<ConfigProvider
|
|
theme={{ algorithm: theme.darkAlgorithm }}
|
|
locale={zhCN}
|
|
renderEmpty={() => <Empty description={'暂无数据'} />}
|
|
>
|
|
<LogtoProvider config={config}>
|
|
<RouterProvider router={route} />
|
|
</LogtoProvider>
|
|
</ConfigProvider>
|
|
</StrictMode>
|
|
);
|
|
|
|
if (import.meta.hot) {
|
|
// With hot module reloading, `import.meta.hot.data` is persisted.
|
|
const root = (import.meta.hot.data.root ??= createRoot(elem));
|
|
root.render(app);
|
|
} else {
|
|
// The hot module reloading API is not available in production.
|
|
createRoot(elem).render(app);
|
|
}
|