2
0

fix: Allow webhook with basic auth

This commit is contained in:
Baptiste Arnaud
2022-02-15 12:36:08 +01:00
parent b95d907e8f
commit 93e8f90ac3
9 changed files with 38 additions and 37 deletions

View File

@ -14,7 +14,6 @@ import {
IntegrationStepType,
LogicStepType,
Step,
StepIndices,
StepOptions,
TextBubbleStep,
Webhook,
@ -44,7 +43,6 @@ type Props = {
onExpandClick: () => void
onStepChange: (updates: Partial<Step>) => void
onTestRequestClick: () => void
indices: StepIndices
}
export const SettingsPopoverContent = ({ onExpandClick, ...props }: Props) => {
@ -87,13 +85,11 @@ export const StepSettings = ({
step,
onStepChange,
onTestRequestClick,
indices,
}: {
step: Step
webhook?: Webhook
onStepChange: (step: Partial<Step>) => void
onTestRequestClick: () => void
indices: StepIndices
}) => {
const handleOptionsChange = (options: StepOptions) => {
onStepChange({ options } as Partial<Step>)
@ -210,7 +206,6 @@ export const StepSettings = ({
onOptionsChange={handleOptionsChange}
onWebhookChange={handleWebhookChange}
onTestRequestClick={onTestRequestClick}
indices={indices}
/>
)
}

View File

@ -20,7 +20,6 @@ import {
Webhook,
ResponseVariableMapping,
WebhookStep,
StepIndices,
} from 'models'
import { DropdownList } from 'components/shared/DropdownList'
import { TableList, TableListItemProps } from 'components/shared/TableList'
@ -39,15 +38,13 @@ type Props = {
onOptionsChange: (options: WebhookOptions) => void
onWebhookChange: (updates: Partial<Webhook>) => void
onTestRequestClick: () => void
indices: StepIndices
}
export const WebhookSettings = ({
step: { webhook, options },
step: { webhook, options, blockId, id: stepId },
onOptionsChange,
onWebhookChange,
onTestRequestClick,
indices,
}: Props) => {
const { typebot, save } = useTypebot()
const [isTestResponseLoading, setIsTestResponseLoading] = useState(false)
@ -85,12 +82,11 @@ export const WebhookSettings = ({
await save()
const { data, error } = await executeWebhook(
typebot.id,
webhook.id,
convertVariableForTestToVariables(
options.variablesForTest,
typebot.variables
),
indices
{ blockId, stepId }
)
if (error) return toast({ title: error.name, description: error.message })
setTestResponse(JSON.stringify(data, undefined, 2))