Skip to content

Commit

Permalink
allow masa tools to receive payload in the path
Browse files Browse the repository at this point in the history
  • Loading branch information
gabitanalla committed May 9, 2022
1 parent d10e0a1 commit bac88d8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/common/components/rest-method/rest-method.tsx
Expand Up @@ -31,13 +31,22 @@ export const RestMethod = ({

const [pathParameters, setPathParameters] = useState(() => {
const customParameterObject = {};
const pathParametersList = name.split(':');
const cleanPath = name.split('?')
const pathParametersList = cleanPath[0].split(':');
pathParametersList.shift();
pathParametersList.forEach((pathParameter) => {
const pathParameterClean = pathParameter.split('/');
//@ts-ignore
customParameterObject[pathParameterClean[0]] = '';
});
if (cleanPath.length>1) {
const pathParameters = cleanPath[1].split('&')
pathParameters.forEach((pathParameter) => {
const parameter = pathParameter.split(':')[1]
// @ts-ignore
customParameterObject[parameter] = '';
})
}
return customParameterObject;
});
const { getData, data } = useMethod({ pathParameters, body: customParameters });
Expand Down

0 comments on commit bac88d8

Please sign in to comment.