From 0fc666a7697b63e0ba9a5c314c031307f7aa3a65 Mon Sep 17 00:00:00 2001 From: Birdmachine Date: Mon, 21 Oct 2024 07:16:39 -0400 Subject: [PATCH] connects up the successful publish behavior & better handles resetting ui elements on failure --- .../components/collections/collections.jsx | 22 ++++-------------- .../components/collections/epicollections.jsx | 23 ++++++------------- 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/src/components/collections/collections.jsx b/src/src/components/collections/collections.jsx index 96885850..fb829b3b 100644 --- a/src/src/components/collections/collections.jsx +++ b/src/src/components/collections/collections.jsx @@ -482,32 +482,20 @@ export function CollectionForm (props){ setPublishing(true) ingest_api_publish_collection(props.authToken,editingCollection.uuid) .then((response) => { - console.debug('%c◉ PUBLISHED ', 'color:#00ff7b', ); - // props.onProcessed(response); if(response.status === 200){ - // GOOD - console.debug('%c◉ Good ', 'color:#00ff7b', response); + console.debug('%c◉ Good ingest_api_publish_collection ', 'color:#00ff7b', response); + props.onProcessed(response.results); }else{ - // BAD - console.debug('%c◉ handlePublishErr Bad result', 'color:#00ff7b', response); + console.debug('%c◉ ingest_api_publish_collection Bad result', 'color:#ff337b', response); setPublishing(false) let authMessage = response.status === 401 ? "User must be Authorized" : response.results.error.toString(); setPageError(response.status + " | " + authMessage); - // setPublishError({ - // status:response.status, - // message: response.results.error ? response.results.error : response.results.toString() - // }) } }) .catch((error) => { console.debug('%c⭗ handlePublishErr Broken Result', 'color:#ff005d', error); - // status: "", - // message: "", - // isError: null setPageError(error.status + " | " + error.message); - // setPageError(error.toString()); - // setButtonState(""); - + setPublishing(false); }); } @@ -931,7 +919,7 @@ export function CollectionForm (props){ value={formValues.title} /> - {editingCollection.doi_url && ( + {editingCollection && editingCollection.doi_url && ( { console.debug('%c⭗ handlePublishErr Broken Result', 'color:#ff005d', error); - // status: "", - // message: "", - // isError: null setPageError(error.status + " | " + error.message); - // setPageError(error.toString()); - // setButtonState(""); - + setPublishing(false); }); } @@ -947,7 +938,7 @@ export function EPICollectionForm (props){ value={formValues.title} /> - {editingCollection.doi_url && ( + {editingCollection && editingCollection.doi_url && (