monorepo-microservice-rbac/apps/aorta/src/App.tsx
2023-09-07 13:41:32 +08:00

38 lines
974 B
TypeScript

import { DomainServiceProvider } from "./context/domainService";
import { defaultLang, theme } from "./constant";
import { useTracker } from "./hook/useTracker";
import { RouterElements } from "./router";
import { ConfigProvider, App as AntApp } from "antd";
import { useI18n } from "@tavi/i18n";
import "./styles/app.less";
import { useEffect } from "react";
import { antdUtils } from "./AntdUtils";
/**
* 国际化
*/
export const { i18n } = useI18n({
loadPath: "/locales/{{lng}}/{{ns}}.json",
fallbackLng: defaultLang,
debug: false,
});
export const App = () => {
useTracker();
const { notification, message, modal } = AntApp.useApp();
useEffect(() => {
antdUtils
.setMessageInstance(message)
.setModalInstance(modal)
.setNotificationInstance(notification);
}, []);
return (
<DomainServiceProvider>
<ConfigProvider theme={theme}>
<RouterElements />
</ConfigProvider>
</DomainServiceProvider>
);
};