Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrected WebookFormSchema type variable into WebhookFormSchema #1678

Merged
merged 11 commits into from
Sep 10, 2024
6 changes: 3 additions & 3 deletions components/webhook/CreateWebhook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useTranslation } from 'next-i18next';
import React from 'react';
import toast from 'react-hot-toast';
import type { ApiResponse } from 'types';
import type { WebookFormSchema } from 'types';
import type { WebhookFormSchema } from 'types';

import ModalForm from './Form';
import { defaultHeaders } from '@/lib/common';
Expand All @@ -23,8 +23,8 @@ const CreateWebhook = ({
const { t } = useTranslation('common');

const onSubmit = async (
values: WebookFormSchema,
formikHelpers: FormikHelpers<WebookFormSchema>
values: WebhookFormSchema,
formikHelpers: FormikHelpers<WebhookFormSchema>
) => {
const response = await fetch(`/api/teams/${team.slug}/webhooks`, {
method: 'POST',
Expand Down
6 changes: 3 additions & 3 deletions components/webhook/EditWebhook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useTranslation } from 'next-i18next';
import React from 'react';
import toast from 'react-hot-toast';
import type { EndpointOut } from 'svix';
import type { WebookFormSchema } from 'types';
import type { WebhookFormSchema } from 'types';
import type { ApiResponse } from 'types';

import ModalForm from './Form';
Expand Down Expand Up @@ -37,8 +37,8 @@ const EditWebhook = ({
}

const onSubmit = async (
values: WebookFormSchema,
formikHelpers: FormikHelpers<WebookFormSchema>
values: WebhookFormSchema,
formikHelpers: FormikHelpers<WebhookFormSchema>
) => {
const response = await fetch(
`/api/teams/${team.slug}/webhooks/${endpoint.id}`,
Expand Down
4 changes: 2 additions & 2 deletions components/webhook/EventTypes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { eventTypes } from '@/lib/common';
import React, { ReactElement } from 'react';
import type { WebookFormSchema } from 'types';
import type { WebhookFormSchema } from 'types';
import { Checkbox } from '../shared';

const EventTypes = ({
Expand All @@ -9,7 +9,7 @@ const EventTypes = ({
error,
}: {
onChange: React.ChangeEventHandler<HTMLInputElement>;
values: WebookFormSchema['eventTypes'];
values: WebhookFormSchema['eventTypes'];
error: string | string[] | undefined;
}) => {
const events: ReactElement[] = [];
Expand Down
8 changes: 4 additions & 4 deletions components/webhook/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useFormik } from 'formik';
import { useTranslation } from 'next-i18next';
import React from 'react';
import { Button } from 'react-daisyui';
import type { WebookFormSchema } from 'types';
import type { WebhookFormSchema } from 'types';
import * as Yup from 'yup';
import Modal from '../shared/Modal';
import { EventTypes } from '@/components/webhook';
Expand All @@ -13,8 +13,8 @@ import { maxLengthPolicies } from '@/lib/common';
interface FormProps {
visible: boolean;
setVisible: (visible: boolean) => void;
initialValues: WebookFormSchema;
onSubmit: FormikConfig<WebookFormSchema>['onSubmit'];
initialValues: WebhookFormSchema;
onSubmit: FormikConfig<WebhookFormSchema>['onSubmit'];
title: string;
editMode?: boolean;
}
Expand All @@ -27,7 +27,7 @@ const Form = ({
title,
editMode = false,
}: FormProps) => {
const formik = useFormik<WebookFormSchema>({
const formik = useFormik<WebhookFormSchema>({
validationSchema: Yup.object().shape({
name: Yup.string().required().max(maxLengthPolicies.webhookDescription),
url: Yup.string().required().url().max(maxLengthPolicies.webhookEndpoint),
Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type TeamWithMemberCount = Prisma.TeamGetPayload<{
};
}>;

export type WebookFormSchema = {
export type WebhookFormSchema = {
name: string;
url: string;
eventTypes: string[];
Expand Down