From 6ac08b6d488bd5d77ff68d49e612a1c06aad64c2 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 17 Jul 2020 13:36:25 +0200 Subject: [PATCH] publish feedback tweaks --- src/components/pages/Publish/PublishForm.tsx | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/pages/Publish/PublishForm.tsx b/src/components/pages/Publish/PublishForm.tsx index 62f17855c..6037e9096 100644 --- a/src/components/pages/Publish/PublishForm.tsx +++ b/src/components/pages/Publish/PublishForm.tsx @@ -55,13 +55,17 @@ export default function PublishForm({ content: FormContent }): ReactElement { const { ocean, account } = useOcean() - const { publish, publishStepText, isLoading, publishError } = usePublish() + const { + publish, + publishStepText, + publishStep, + isLoading, + publishError + } = usePublish() const navigate = useNavigate() const { marketAddress } = useSiteMetadata() async function handleSubmit(values: MetadataPublishForm) { - const submittingToast = toast.info('submitting asset') - console.log(` Collected form values: ---------------------- @@ -85,15 +89,20 @@ export default function PublishForm({ { serviceType, cost: '1' } ]) + if (publishError) { + toast.error(publishError) + return null + } + // User feedback and redirect to new asset detail page - ddo && toast.success('asset created successfully') - toast.dismiss(submittingToast) + ddo && toast.success('Asset created successfully.') // TODO: reset form state and make sure persistant form in localStorage is cleared navigate(`/asset/${ddo.id}`) } catch (error) { console.error(error.message) + toast.error(error.message) } } @@ -118,8 +127,6 @@ export default function PublishForm({ {isLoading ? ( - ) : publishError ? ( - ) : (