63 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-01-06 01:52:26 +01:00
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>
2020-01-06 10:48:34 +01:00
<td title={{ error }}>{error}</td>
2020-01-06 01:52:26 +01:00
</>
)}
</>
)}
</tr>
</tbody>
</table>
</Wrapper>
);
};
TriggerContainer.defaultProps = {
isPending: false,
onCancel: () => {},
};
TriggerContainer.propTypes = {
isPending: PropTypes.bool,
onCancel: PropTypes.func,
response: PropTypes.object,
};
export default TriggerContainer;