Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwellmlin committed Oct 21, 2023
1 parent dc87705 commit 04ae980
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ function CallServicePanel({ context }: { context: PanelExtensionContext }): JSX.
}, [renderDone]);

const callService = useCallback(
(serviceName: string, request: string) => {
async (serviceName: string, request: string) => {
if (!context.callService) {
return;
}

try {
const response = context.callService(serviceName, JSON.parse(request));
const response = await context.callService(serviceName, JSON.parse(request));
JSON.stringify(response); // Attempt serializing the response, to throw an error on failure
setState((oldState) => ({
...oldState,
Expand Down Expand Up @@ -86,8 +86,8 @@ function CallServicePanel({ context }: { context: PanelExtensionContext }): JSX.
<button
disabled={context.callService == undefined || state.serviceName === ""}
style={{ width: "100%", minHeight: "2rem" }}
onClick={() => {
callService(state.serviceName, state.request);
onClick={async () => {
await callService(state.serviceName, state.request);
}}
>
{`Call ${state.serviceName}`}
Expand Down

0 comments on commit 04ae980

Please sign in to comment.