Function: useAgent()
useAgent():
null|Agent
Defined in: web/lib/auth/auth-context.tsx:370
Hook to get the ATProto Agent for making authenticated API calls.
Returns
null | Agent
Agent instance or null if not authenticated
Remarks
The Agent handles authentication automatically, including token refresh.
Example
function MyComponent() {
const agent = useAgent();
const fetchProfile = async () => {
if (!agent) return;
const profile = await agent.getProfile({ actor: agent.accountDid });
};
}