When to use
- Read the signed-in admin user (userInfo) — there is no useCurrentUserStore
- Check login with user.isLogin()
- Subscribe to shell registry slices (menus, routes, locale helpers)
- Do not duplicate session state in a plugin-local Zustand store
Signature
Unlike most shell stores, useAppRegistry is a single call. Prefer a selector so components re-render only when the selected slice changes.
TSsignature
function useAppRegistry(): AppRegistryState;
function useAppRegistry<T>(selector: (s: AppRegistryState) => T): T;Usage
TSXuserInfo
1import { useAppRegistry } from "@quan-erp/base-frontend";
2
3const userInfo = useAppRegistry((s) => s.userInfo);
4const isOwner = useAppRegistry((s) => s.userInfo?.isOwner ?? false);
5
6if (!userInfo) return null;Notes
- See Core → Current login user for full session helpers
- setUser / logout belong to the shell login flow
- Public customer apps use a separate cookie/session pattern