| 101 | // re-render the webhook |
| 102 | // * update the URL so people can link to a specific webhook action type |
| 103 | function handleActionTypeChange(type: string, index: number) { |
| 104 | setClickedBodyParameterName('') |
| 105 | setSelectedWebhookActionType(type) |
| 106 | setSelectedActionTypeIndex(index) |
| 107 | |
| 108 | const { asPath } = router |
| 109 | let [pathRoot, pathQuery = ''] = asPath.split('?') |
| 110 | const params = new URLSearchParams(pathQuery) |
| 111 | |
| 112 | if (pathRoot.includes('#')) { |
| 113 | pathRoot = pathRoot.split('#')[0] |
| 114 | } |
| 115 | |
| 116 | params.set('actionType', type) |
| 117 | router.push({ pathname: pathRoot, query: params.toString(), hash: webhookSlug }, undefined, { |
| 118 | shallow: true, |
| 119 | locale, |
| 120 | }) |
| 121 | } |
| 122 | |
| 123 | // callback to trigger useSWR() hook after a nested property is clicked |
| 124 | function handleBodyParamExpansion(event: KeyboardEvent<HTMLElement>) { |