mirror of
https://github.com/strapi/strapi.git
synced 2025-08-15 12:18:38 +00:00
63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
![]() |
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import { useGlobalContext } from 'strapi-helper-plugin';
|
||
|
|
||
|
import Wrapper from './Wrapper';
|
||
|
|
||
|
const TriggerContainer = ({ isPending, onCancel, response }) => {
|
||
|
const { formatMessage } = useGlobalContext();
|
||
|
const { error } = response;
|
||
|
|
||
|
return (
|
||
|
<Wrapper>
|
||
|
<table>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>Test-trigger</p>
|
||
|
</td>
|
||
|
|
||
|
{isPending ? (
|
||
|
<>
|
||
|
<td>Pending...</td>
|
||
|
<td>
|
||
|
<button onClick={onCancel}>
|
||
|
{formatMessage({ id: `Settings.webhooks.trigger.cancel` })}
|
||
|
</button>
|
||
|
</td>
|
||
|
</>
|
||
|
) : (
|
||
|
<>
|
||
|
{!error ? (
|
||
|
<>
|
||
|
<td>Success!</td>
|
||
|
<td>Trigger succeded</td>
|
||
|
</>
|
||
|
) : (
|
||
|
<>
|
||
|
<td>Error 403</td>
|
||
|
<td>{error}</td>
|
||
|
</>
|
||
|
)}
|
||
|
</>
|
||
|
)}
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</Wrapper>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
TriggerContainer.defaultProps = {
|
||
|
isPending: false,
|
||
|
onCancel: () => {},
|
||
|
};
|
||
|
|
||
|
TriggerContainer.propTypes = {
|
||
|
isPending: PropTypes.bool,
|
||
|
onCancel: PropTypes.func,
|
||
|
response: PropTypes.object,
|
||
|
};
|
||
|
|
||
|
export default TriggerContainer;
|