diff --git a/src/app/(site)/(internal)/dashboard/components/dreams/forms/tags/AddTagForm.tsx b/src/app/(site)/(internal)/dashboard/components/dreams/forms/tags/AddTagForm.tsx index 4e29c79..03f3b1d 100644 --- a/src/app/(site)/(internal)/dashboard/components/dreams/forms/tags/AddTagForm.tsx +++ b/src/app/(site)/(internal)/dashboard/components/dreams/forms/tags/AddTagForm.tsx @@ -50,21 +50,21 @@ const AddTagForm: FC = ({onSuccess}) => { const onSubmit: SubmitHandler = async (data) => { if (!session?.user) return; - - await toast.promise(tags.optimisticData - .addOptimisticData(() => handleCreation(data), { - id: '', - ...data, - createdAt: new Date(), - updatedAt: new Date(), - userId: session.user.id - }), - { - loading: "Adding new tag...", - success: "Successfully added that tag!", - error: "Could not add that tag!" - } - ) + if (tags.optimisticData.addOptimisticData) + await toast.promise(tags.optimisticData + .addOptimisticData(() => handleCreation(data), { + id: '', + ...data, + createdAt: new Date(), + updatedAt: new Date(), + userId: session.user.id + }), + { + loading: "Adding new tag...", + success: "Successfully added that tag!", + error: "Could not add that tag!" + } + ) }