Skip to content

Commit

Permalink
fix(console): api gateway ui loose the endpoint while editing body (#…
Browse files Browse the repository at this point in the history
…6527)

Fixes #6525
  • Loading branch information
polamoros authored May 21, 2024
1 parent a93ede6 commit b52261d
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions apps/wing-console/console/ui/src/ui/api-interaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -316,28 +316,10 @@ export const ApiInteraction = memo(
],
);

const loadRoutesFromOpenApi = useCallback(() => {
const routes = getRoutesFromOpenApi(openApiSpec);
setRoutes(routes);
const currentRouteExists = routes.some(
(value) => value.route === currentRoute,
);
setCurrentRoute(currentRouteExists ? currentRoute : "");

if (!currentMethod) {
const methods = routes
.filter((item) => {
return item.route === currentRoute;
})
.map((route) => route.method);
handleMethodChange(currentRoute, methods[0] ?? "GET");
}
}, [openApiSpec, currentMethod, currentRoute, handleMethodChange]);

// load the routes from the open api spec on mount
useEffect(() => {
loadRoutesFromOpenApi();
}, [openApiSpec, loadRoutesFromOpenApi]);
setRoutes(getRoutesFromOpenApi(openApiSpec));
}, [openApiSpec]);

// Load the possible values for the current header key
useEffect(() => {
Expand Down

0 comments on commit b52261d

Please sign in to comment.