import { useAuth } from '@hooks/use-auth';
import type { ActiveRole } from '@t/enums';
import type { UserRoleItem } from '@t/enums';
import { cn } from '@lib/utils';
interface RegisterRoleSwitcherProps {
value: UserRoleItem;
onChange: (role: UserRoleItem) => void;
}
export function RegisterRoleSwitcher({ value, onChange }: RegisterRoleSwitcherProps) {
const handleSwitch = (e: React.MouseEvent, role: UserRoleItem) => {
e.preventDefault();
onChange(role);
};
return (
);
}
export function RoleSwitcher() {
const { activeRole, switchRole } = useAuth();
const handleSwitch = (e: React.MouseEvent, role: ActiveRole) => {
e.preventDefault();
switchRole.mutate({ activeRole: role });
};
return (
);
}