|
1 | 1 | import{API}from"api/api";
|
| 2 | +import{getErrorMessage}from"api/errors"; |
2 | 3 | importtype{Workspace,WorkspaceAgent}from"api/typesGenerated";
|
3 | 4 | importisChromaticfrom"chromatic/isChromatic";
|
4 | 5 | import{CodeExample}from"components/CodeExample/CodeExample";
|
| 6 | +import{displayError}from"components/GlobalSnackbar/utils"; |
5 | 7 | import{typeFC,useEffect,useState}from"react";
|
6 | 8 |
|
7 | 9 | interfaceAgentExternalProps{
|
@@ -29,6 +31,8 @@ export const AgentExternal: FC<AgentExternalProps> = ({
|
29 | 31 | API.getWorkspaceAgentCredentials(workspace.id,agent.name).then((res)=>{
|
30 | 32 | setExternalAgentToken(res.agent_token);
|
31 | 33 | setCommand(res.command);
|
| 34 | +}).catch((err)=>{ |
| 35 | +displayError(getErrorMessage(err,"Failed to get external agent credentials")); |
32 | 36 | });
|
33 | 37 | }
|
34 | 38 | },[isExternalAgent,agent.status,workspace.id,agent.name]);
|
|