-
Notifications
You must be signed in to change notification settings - Fork 9k
/
webhooks.jsx
45 lines (38 loc) · 1.17 KB
/
webhooks.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* @prettier
*/
import React from "react"
import PropTypes from "prop-types"
const Webhooks = ({ specSelectors, getComponent }) => {
const operationDTOs = specSelectors.selectWebhooksOperations()
const pathItemNames = Object.keys(operationDTOs)
const OperationContainer = getComponent("OperationContainer", true)
if (pathItemNames.length === 0) return null
return (
<div className="webhooks">
<h2>Webhooks</h2>
{pathItemNames.map((pathItemName) => (
<div key={`${pathItemName}-webhook`}>
{operationDTOs[pathItemName].map((operationDTO) => (
<OperationContainer
key={`${pathItemName}-${operationDTO.method}-webhook`}
op={operationDTO.operation}
tag="webhooks"
method={operationDTO.method}
path={pathItemName}
specPath={operationDTO.specPath}
allowTryItOut={false}
/>
))}
</div>
))}
</div>
)
}
Webhooks.propTypes = {
specSelectors: PropTypes.shape({
selectWebhooksOperations: PropTypes.func.isRequired,
}).isRequired,
getComponent: PropTypes.func.isRequired,
}
export default Webhooks