|
|
il y a 1 mois | |
|---|---|---|
| .. | ||
| src | il y a 1 mois | |
| tests | il y a 1 mois | |
| README.md | il y a 1 mois | |
| build.config.ts | il y a 1 mois | |
| eslint.config.js | il y a 1 mois | |
| package.json | il y a 1 mois | |
| test-summary.md | il y a 1 mois | |
| tsconfig.json | il y a 1 mois | |
| verify-exports-simple.mjs | il y a 1 mois | |
| verify-exports.js | il y a 1 mois | |
| verify-exports.mjs | il y a 1 mois | |
| vitest.config.ts | il y a 1 mois | |
单租户认证管理界面独立包,提供完整的用户认证和登录功能。
pnpm add @d8d/auth-management-ui
import { AuthProvider, AuthManagement } from '@d8d/auth-management-ui';
function App() {
return (
<AuthProvider>
<AuthManagement />
</AuthProvider>
);
}
import { useAuth } from '@d8d/auth-management-ui';
function UserProfile() {
const { user, isAuthenticated, login, logout } = useAuth();
if (!isAuthenticated) {
return <div>请先登录</div>;
}
return (
<div>
<h1>欢迎,{user?.username}</h1>
<button onClick={logout}>退出登录</button>
</div>
);
}
import { LoginPage } from '@d8d/auth-management-ui';
function LoginRoute() {
return <LoginPage />;
}
AuthProvider - 认证状态管理组件AuthManagement - 主认证管理组件LoginPage - 登录页面组件useAuth - 认证状态和操作hookauthClient - 认证API客户端authEndpoints - 认证API端点配置AuthContextType - 认证上下文类型AuthStatus - 认证状态类型AuthConfig - 认证配置类型pnpm build
pnpm test
node verify-exports-simple.mjs
@d8d/shared-ui-components - 共享UI组件@d8d/auth-module - 认证模块APIreact - React框架@tanstack/react-query - 数据获取和状态管理react-hook-form - 表单处理react-router - 路由管理MIT