Skip to content

Commit

Permalink
feat(frontend): try/catch on fetch deployed agent
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed Feb 28, 2025
1 parent ee80b49 commit 9832805
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions frontend/src/pages/deployed-agents/[agentDeployId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ export default function DeployAgentsPage() {
const [deployedAgent, setDeployedAgent] = useState<DeployedAgent>();

const handleFetchDeployedAgent = useCallback(async (id: string) => {
const response = await fetch(`${agentsApiServer}/agent/${id}`);
const data = await response.json();

console.log("fetched deployed agent", data);

setDeployedAgent(data);
try {
const response = await fetch(`${agentsApiServer}/agent/${id}`);
const data = await response.json();
console.log("fetched deployed agent", data);

setDeployedAgent(data);
} catch (e) {
console.error(e);
}
}, []);

const requiresUserAction = useCallback((agent: DeployedAgent) => {
Expand Down

0 comments on commit 9832805

Please sign in to comment.