Next.js Discord

Discord Forum

Call unsuccessfull after 7 tries

Unanswered
Elm sawfly posted this in #help-forum
Open in Discord
Avatar
Elm sawflyOP
It is showing that the error is on line EventForm.tsx:45

    async function onSubmit(values: z.infer<typeof eventFormSchema>) {
        let uploadedImageUrl = values.imageUrl;

        if (files.length > 0) {
            const uploadedImages = await startUpload(files);

            if (!uploadedImages) return;

            uploadedImageUrl = uploadedImages[0].url
        }

        if (type === "Create") {
            try {
                const newEvent = await createEvent({
                    event: { ...values, imageUrl: uploadedImageUrl },
                    userId,
                    path: "/profile"
                })

                if (newEvent) {
                    form.reset();
                    router.push(`/events/${newEvent._id}`)
                }
            } catch (error) {
                console.log(error);
            };
        };
    };


Code that is on line 45 is:
const uploadedImages = await startUpload(files);
Image

1 Reply

Avatar
Elm sawflyOP
That stopUpload comes from uploadThing
 const { startUpload } = useUploadThing('imageUploader');