Skip to content

Commit 5486354

Browse files
committed
allow add :id as arg
1 parent d4ce5b7 commit 5486354

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/extension-api-caller/src/lib/filters/restApiCaller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ export const RestApiCallerFilter: FunctionalFilter = async ({
1111
value,
1212
}) => {
1313
if (!args['url']) throw new InternalError('url is required');
14-
const results = await axios.get<Array<any>>(args['url'], {
15-
params: args['arg'] ? { [args['arg']]: value } : {},
14+
const url = args['arg'] && args['arg'] === ':id' ? `${args['url']}/${value}` : args['url'];
15+
const results = await axios.get<Array<any>>(url, {
16+
params: args['arg'] && args['arg'] !== ':id' ? { [args['arg']]: value } : {},
1617
});
1718

1819
return JSON.stringify(results.data);

0 commit comments

Comments
 (0)