@adonis-agora/authkit-react
Version:
Frontend ergonomics over AuthKit for AdonisJS + Inertia + React apps: a typed useAuth() hook, role-gating hooks and gating components.
24 lines (23 loc) • 566 B
TypeScript
export interface AuthUser {
id: string;
email: string;
name?: string;
avatarUrl?: string;
globalRoles: string[];
[key: string]: unknown;
}
export interface AuthSharedProps {
authkit: {
user: AuthUser | null;
globalRoles: string[];
};
[key: string]: unknown;
}
export interface AuthState {
user: AuthUser | null;
isAuthenticated: boolean;
globalRoles: string[];
hasGlobalRole(role: string): boolean;
hasAnyGlobalRole(roles: string[]): boolean;
hasAllGlobalRoles(roles: string[]): boolean;
}