lint for passing builds

This commit is contained in:
gingervitis
2021-02-15 00:36:06 -08:00
parent c1719e656b
commit 97187f5541
7 changed files with 99 additions and 103 deletions

View File

@@ -37,12 +37,19 @@ function convertEventStringToTag(eventString) {
</Tooltip>
);
}
interface Props {
onCancel: () => void;
onOk: any; // todo: make better type
visible: boolean;
}
function NewWebhookModal(props: Props) {
const { onOk, onCancel, visible } = props;
function NewWebhookModal(props) {
const [selectedEvents, setSelectedEvents] = useState([]);
const [webhookUrl, setWebhookUrl] = useState('');
const events = Object.keys(availableEvents).map(function (key) {
const events = Object.keys(availableEvents).map(key => {
return { value: key, label: availableEvents[key].description };
});
@@ -55,7 +62,7 @@ function NewWebhookModal(props) {
}
function save() {
props.onOk(webhookUrl, selectedEvents);
onOk(webhookUrl, selectedEvents);
// Reset the modal
setWebhookUrl('');
@@ -69,9 +76,9 @@ function NewWebhookModal(props) {
return (
<Modal
title="Create New Webhook"
visible={props.visible}
visible={visible}
onOk={save}
onCancel={props.onCancel}
onCancel={onCancel}
okButtonProps={okButtonProps}
>
<div>
@@ -127,14 +134,19 @@ export default function Webhooks() {
},
];
const getWebhooks = async () => {
function handleError(error) {
console.error('error', error);
alert(error);
}
async function getWebhooks() {
try {
const result = await fetchData(WEBHOOKS);
setWebhooks(result);
} catch (error) {
handleError(error);
}
};
}
useEffect(() => {
getWebhooks();
@@ -142,7 +154,7 @@ export default function Webhooks() {
async function handleDelete(id) {
try {
const result = await fetchData(DELETE_WEBHOOK, { method: 'POST', data: { id: id } });
await fetchData(DELETE_WEBHOOK, { method: 'POST', data: { id } });
getWebhooks();
} catch (error) {
handleError(error);
@@ -153,7 +165,7 @@ export default function Webhooks() {
try {
const newHook = await fetchData(CREATE_WEBHOOK, {
method: 'POST',
data: { url: url, events: events },
data: { url, events },
});
setWebhooks(webhooks.concat(newHook));
} catch (error) {
@@ -161,11 +173,6 @@ export default function Webhooks() {
}
}
function handleError(error) {
console.error('error', error);
alert(error);
}
const showCreateModal = () => {
setIsModalVisible(true);
};
@@ -185,7 +192,7 @@ export default function Webhooks() {
<Paragraph>
A webhook is a callback made to an external API in response to an event that takes place
within Owncast. This can be used to build chat bots or sending automatic notifications that
you've started streaming.
you&apos;ve started streaming.
</Paragraph>
<Paragraph>
Read more about how to use webhooks, with examples, at{' '}