Skip to content

Commit

Permalink
wip12
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri Mandrikov committed Jan 16, 2024
1 parent 5d78f16 commit 732d33f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion enapter-commands-panel/src/hooks/useRunCommandWorkflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class EnapterApiError extends Error {}
export class UnknownCommandError extends Error {}

const getArgValue = (arg: Argument) => {
console.log('replace', arg.displayName, arg.value, replaceVariables(String(arg.value)));

if (arg.type === 'boolean') {
return Boolean(arg.value);
}
Expand All @@ -34,14 +36,26 @@ const getArgValue = (arg: Argument) => {
};

const getArgsForRequest = (args: Command['arguments']) => {
console.log('getArgsForRequest');
const argsForRequest: Record<string, any> = {};

if (!args) {
console.log('!args');

return argsForRequest;
}

for (const [argName, arg] of Object.entries(args)) {
argsForRequest[argName] = getArgValue(arg);
const value = getArgValue(arg);
console.log('value', value);
console.log('argName', argName);

if (value === null || Number.isNaN(value)) {
console.log('value === null');
continue;
}

argsForRequest[argName] = value;
}

return argsForRequest;
Expand Down

0 comments on commit 732d33f

Please sign in to comment.