fix: webhook ui

This commit is contained in:
Lakhan Samani
2022-07-17 17:18:45 +05:30
parent 89606615dc
commit 891c885f20
3 changed files with 15 additions and 8 deletions

View File

@@ -30,7 +30,7 @@ import {
FiMenu,
FiUsers,
FiChevronDown,
FiAnchor,
FiLink,
} from 'react-icons/fi';
import { BiCustomize } from 'react-icons/bi';
import { AiOutlineKey } from 'react-icons/ai';
@@ -112,7 +112,7 @@ const LinkItems: Array<LinkItemProps> = [
],
},
{ name: 'Users', icon: FiUsers, route: '/users' },
{ name: 'Webhooks', icon: FiAnchor, route: '/webhooks' },
{ name: 'Webhooks', icon: FiLink, route: '/webhooks' },
];
interface SidebarProps extends BoxProps {

View File

@@ -84,7 +84,7 @@ interface validatorDataType {
const initWebhookData: webhookDataType = {
[WebhookInputDataFields.EVENT_NAME]: webhookEventNames.USER_LOGIN,
[WebhookInputDataFields.ENDPOINT]: '',
[WebhookInputDataFields.ENABLED]: false,
[WebhookInputDataFields.ENABLED]: true,
[WebhookInputDataFields.HEADERS]: [{ ...initHeadersData }],
};
@@ -335,7 +335,10 @@ const UpdateWebhookModal = ({
setVerifyingEndpoint(true);
const { [WebhookInputDataFields.ENABLED]: _, ...params } = getParams();
const res = await client.mutation(TestEndpoint, { params }).toPromise();
if (res.data?._test_endpoint?.response?.success) {
if (
res.data?._test_endpoint?.http_status >= 200 &&
res.data?._test_endpoint?.http_status < 400
) {
setVerifiedStatus(webhookVerifiedStatus.VERIFIED);
} else {
setVerifiedStatus(webhookVerifiedStatus.NOT_VERIFIED);