Skip to content

Commit

Permalink
Rename file upload functions
Browse files Browse the repository at this point in the history
  • Loading branch information
samthomp14 committed Nov 3, 2024
1 parent 35eb0b9 commit 95e2c45
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/src/pages/CreateWorkshop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ const CreateWorkshop = () => {
const [success, setSuccess] = useState(false)
const [errorMessage, setErrorMessage] = useState("")

const initialValues2 = {
const fileUploadInitialValues = {
title: "",
desc: "",
file: "",
}
const validationSchema2 = Yup.object().shape({
const fileValidation = Yup.object().shape({
title: Yup.string().required("Title is required"),
desc: Yup.string().required("Description is required"),
file: Yup.mixed().required("Please select a file")
})

const handleSubmit2 = async (values: any, { resetForm }: any) => {
const handleFileSumbit = async (values: any, { resetForm }: any) => {
setIsLoading(true)
setErrorMessage("") // Clear error message at the start of submission

Expand Down Expand Up @@ -62,9 +62,9 @@ const CreateWorkshop = () => {
action={() => setIsModal(false)}
body={
<Formik
initialValues={initialValues2}
validationSchema={validationSchema2}
onSubmit={handleSubmit2}
initialValues={fileUploadInitialValues}
validationSchema={fileValidation}
onSubmit={handleFileSumbit}
>
{({ values, errors, touched, isSubmitting }) => (
<Form>
Expand Down

0 comments on commit 95e2c45

Please sign in to comment.